summaryrefslogtreecommitdiff
path: root/src/uml
diff options
context:
space:
mode:
authorMichal Privoznik <mprivozn@redhat.com>2015-09-22 16:52:03 +0200
committerMichal Privoznik <mprivozn@redhat.com>2015-09-24 10:52:37 +0200
commit37405b910907bd1ad338fb0d6a967bfd23529cf6 (patch)
treeb244c25385427f01a9442386de4b46abed0b3260 /src/uml
parent3824c19df8b5170aacf5c728d251213e77a46aae (diff)
downloadlibvirt-37405b910907bd1ad338fb0d6a967bfd23529cf6.tar.gz
virDomainCreateXML: Don't remove persistent domains on error
https://bugzilla.redhat.com/show_bug.cgi?id=871452 Okay, so we allow users to 'virsh create' an already existing domain, providing completely different XML than the one stored in Libvirt. Well, as long as name and UUID matches. However, in some drivers the code that handles errors unconditionally removes the domain that failed to start even though the domain might have been persistent. Fortunately, the domain is removed just from the internal list of domains and the config file is kept around. Steps to reproduce: 1) virsh dumpxml $dom > /tmp/dom.xml 2) change XML so that it is still parse-able but won't boot, e.g. change guest agent path to /foo/bar 3) virsh create /tmp/dom.xml 4) virsh dumpxml $dom 5) Observe "No such domain" error Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Diffstat (limited to 'src/uml')
-rw-r--r--src/uml/uml_driver.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/uml/uml_driver.c b/src/uml/uml_driver.c
index 2b61f73aff..d4b03b39e4 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);