diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c index a9f0005f55b3a184994403920b7d508be26fc562..e5e6c5abe5eb4dd90da915e873f7ad174faea6ba 100644 --- a/src/lxc/lxc_driver.c +++ b/src/lxc/lxc_driver.c @@ -1239,8 +1239,10 @@ lxcDomainCreateXMLWithFiles(virConnectPtr conn, (flags & VIR_DOMAIN_START_AUTODESTROY), VIR_DOMAIN_RUNNING_BOOTED) < 0) { virDomainAuditStart(vm, "booted", false); - virDomainObjListRemove(driver->domains, vm); - vm = NULL; + if (!vm->persistent) { + virDomainObjListRemove(driver->domains, vm); + vm = NULL; + } goto cleanup; } diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 2387cf3f96994f841a0b513aea11e1d3dc525763..30d2d988e167a7007f56d5f4e58fea0a92fc7640 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -1752,7 +1752,8 @@ static virDomainPtr qemuDomainCreateXML(virConnectPtr conn, def = NULL; if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MODIFY) < 0) { - qemuDomainRemoveInactive(driver, vm); + if (!vm->persistent) + qemuDomainRemoveInactive(driver, vm); goto cleanup; } @@ -1762,7 +1763,8 @@ static virDomainPtr qemuDomainCreateXML(virConnectPtr conn, start_flags) < 0) { virDomainAuditStart(vm, "booted", false); qemuDomainObjEndJob(driver, vm); - qemuDomainRemoveInactive(driver, vm); + if (!vm->persistent) + qemuDomainRemoveInactive(driver, vm); goto cleanup; } diff --git a/src/test/test_driver.c b/src/test/test_driver.c index d11cda1f72124fc14be0dfe6973b605eb6c04cee..b40b0799de876f91aff8353a6d929680b8203934 100644 --- a/src/test/test_driver.c +++ b/src/test/test_driver.c @@ -1621,8 +1621,13 @@ testDomainCreateXML(virConnectPtr conn, const char *xml, goto cleanup; def = NULL; - if (testDomainStartState(privconn, dom, VIR_DOMAIN_RUNNING_BOOTED) < 0) + if (testDomainStartState(privconn, dom, VIR_DOMAIN_RUNNING_BOOTED) < 0) { + if (!dom->persistent) { + virDomainObjListRemove(privconn->domains, dom); + dom = NULL; + } goto cleanup; + } event = virDomainEventLifecycleNewFromObj(dom, VIR_DOMAIN_EVENT_STARTED, diff --git a/src/uml/uml_driver.c b/src/uml/uml_driver.c index 2b61f73affdaae5612b0a07658500495de4692ee..d4b03b39e43120ac9bed2ceb181c262ef26ea718 100644 --- a/src/uml/uml_driver.c +++ b/src/uml/uml_driver.c @@ -1623,9 +1623,10 @@ static virDomainPtr umlDomainCreateXML(virConnectPtr conn, const char *xml, if (umlStartVMDaemon(conn, driver, vm, (flags & VIR_DOMAIN_START_AUTODESTROY)) < 0) { virDomainAuditStart(vm, "booted", false); - virDomainObjListRemove(driver->domains, - vm); - vm = NULL; + if (!vm->persistent) { + virDomainObjListRemove(driver->domains, vm); + vm = NULL; + } goto cleanup; } virDomainAuditStart(vm, "booted", true); diff --git a/src/vmware/vmware_driver.c b/src/vmware/vmware_driver.c index e228aaa58495fa5feddc4e50721e4332f05b0694..152af398fc747d41409fbb5ef2f3cfbc48779765 100644 --- a/src/vmware/vmware_driver.c +++ b/src/vmware/vmware_driver.c @@ -716,8 +716,10 @@ vmwareDomainCreateXML(virConnectPtr conn, const char *xml, vmdef = NULL; if (vmwareStartVM(driver, vm) < 0) { - virDomainObjListRemove(driver->domains, vm); - vm = NULL; + if (!vm->persistent) { + virDomainObjListRemove(driver->domains, vm); + vm = NULL; + } goto cleanup; }