endjob:
if (vm) {
if (ret != 0) {
- if (header.was_running && priv->mon) {
+ if (header.was_running && virDomainObjIsActive(vm)) {
qemuDomainObjEnterMonitorWithDriver(driver, vm);
rc = qemuMonitorStartCPUs(priv->mon, dom->conn);
qemuDomainObjExitMonitorWithDriver(driver, vm);
/* Since the monitor is always attached to a pty for libvirt, it
will support synchronous operations so we always get here after
the migration is complete. */
- else if (resume && paused && priv->mon) {
+ else if (resume && paused && virDomainObjIsActive(vm)) {
qemuDomainObjEnterMonitorWithDriver(driver, vm);
if (qemuMonitorStartCPUs(priv->mon, dom->conn) < 0) {
if (virGetLastError() == NULL)
return ret;
try_remove:
- if (!priv->mon)
+ if (!virDomainObjIsActive(vm))
goto cleanup;
if (vlan < 0) {
goto cleanup;
try_tapfd_close:
- if (!priv->mon)
+ if (!virDomainObjIsActive(vm))
goto cleanup;
if (tapfd_name) {
retval = doTunnelSendAll(st, client_sock);
cancel:
- if (retval != 0 && priv->mon) {
+ if (retval != 0 && virDomainObjIsActive(vm)) {
qemuDomainObjEnterMonitorWithDriver(driver, vm);
qemuMonitorMigrateCancel(priv->mon);
qemuDomainObjExitMonitorWithDriver(driver, vm);