```
-        except error.CmdError:
+        except (error.CmdError, remote.LoginError), detail:
+            logging.error(detail)
```
Catch LoginError will be more helpful and to avoid unexpected condition.

BTW, I have made a test to your new virsh.undefine and it works well.
So fix this problem and I will merge it.
We can replace remote codes with VirshConnectBack in future. :)