]> xenbits.xensource.com Git - libvirt.git/commitdiff
Do not check for domain liveness in virDomainObjSetDefTransient
authorJán Tomko <jtomko@redhat.com>
Fri, 27 May 2016 12:00:34 +0000 (14:00 +0200)
committerJán Tomko <jtomko@redhat.com>
Mon, 6 Jun 2016 06:34:22 +0000 (08:34 +0200)
Remove the live attribute and mark the definition as transient
whether the domain is runing or not.

There were only two callers left calling with live=false:
* testDomainStartState, where the domain already is active
  because we assigned vm->def->id just a few lines above the call
* virDomainObjGetPersistentDef, which now only calls
  virDomainObjSetDefTransient for an active domain

src/conf/domain_conf.c
src/conf/domain_conf.h
src/libxl/libxl_domain.c
src/lxc/lxc_process.c
src/qemu/qemu_process.c
src/test/test_driver.c
src/uml/uml_driver.c

index ee25e01f9ef21bc2e2237a30639de83c0fddd6f6..11ec80dcf48a5e82142f0e2d3b3c17b20ce8f60c 100644 (file)
@@ -2885,29 +2885,21 @@ virDomainObjWaitUntil(virDomainObjPtr vm,
 
 
 /*
- * Mark the running VM config as transient. Ensures transient hotplug
+ * Mark the current VM config as transient. Ensures transient hotplug
  * operations do not persist past shutdown.
  *
  * @param caps pointer to capabilities info
  * @param xmlopt pointer to XML parser configuration object
  * @param domain domain object pointer
- * @param live if true, run this operation even for an inactive domain.
- *   this allows freely updated domain->def with runtime defaults before
- *   starting the VM, which will be discarded on VM shutdown. Any cleanup
- *   paths need to be sure to handle newDef if the domain is never started.
  * @return 0 on success, -1 on failure
  */
 int
 virDomainObjSetDefTransient(virCapsPtr caps,
                             virDomainXMLOptionPtr xmlopt,
-                            virDomainObjPtr domain,
-                            bool live)
+                            virDomainObjPtr domain)
 {
     int ret = -1;
 
-    if (!virDomainObjIsActive(domain) && !live)
-        return 0;
-
     if (!domain->persistent)
         return 0;
 
@@ -2937,7 +2929,7 @@ virDomainObjGetPersistentDef(virCapsPtr caps,
                              virDomainObjPtr domain)
 {
     if (virDomainObjIsActive(domain) &&
-        virDomainObjSetDefTransient(caps, xmlopt, domain, false) < 0)
+        virDomainObjSetDefTransient(caps, xmlopt, domain) < 0)
         return NULL;
 
     if (domain->newDef)
index b1953b31431ae16cf83ad6cd92eb35ccf73b713f..c182747b669a0c55b4ff2c19186d4d56297a9d48 100644 (file)
@@ -2525,8 +2525,7 @@ void virDomainObjAssignDef(virDomainObjPtr domain,
                            virDomainDefPtr *oldDef);
 int virDomainObjSetDefTransient(virCapsPtr caps,
                                 virDomainXMLOptionPtr xmlopt,
-                                virDomainObjPtr domain,
-                                bool live);
+                                virDomainObjPtr domain);
 virDomainDefPtr
 virDomainObjGetPersistentDef(virCapsPtr caps,
                              virDomainXMLOptionPtr xmlopt,
index 8a3866f90f8ce74f934c7ba2223806087a6a4980..9fe8be04ee72136efec27181ba4aec334f4f3955 100644 (file)
@@ -1096,8 +1096,7 @@ libxlDomainStart(libxlDriverPrivatePtr driver,
         VIR_FREE(managed_save_path);
     }
 
-    if (virDomainObjSetDefTransient(cfg->caps, driver->xmlopt,
-                                    vm, true) < 0)
+    if (virDomainObjSetDefTransient(cfg->caps, driver->xmlopt, vm) < 0)
         goto cleanup;
 
     if (virDomainLockProcessStart(driver->lockManager,
index 058c3e1e7ef2dc05a031a8975634a09222420d51..07eb22af023112d43ef0bb911d8d9577c506f4c2 100644 (file)
@@ -1286,7 +1286,7 @@ int virLXCProcessStart(virConnectPtr conn,
      * report implicit runtime defaults in the XML, like vnc listen/socket
      */
     VIR_DEBUG("Setting current domain def as transient");
-    if (virDomainObjSetDefTransient(caps, driver->xmlopt, vm, true) < 0)
+    if (virDomainObjSetDefTransient(caps, driver->xmlopt, vm) < 0)
         goto cleanup;
 
     /* Run an early hook to set-up missing devices */
index e847cd1f13d15d55e038335f0df564c94d342f30..7a4a2caeb4fe7e4c898e9280d4e7b10a050a5b69 100644 (file)
@@ -4447,7 +4447,7 @@ qemuProcessInit(virQEMUDriverPtr driver,
      * report implicit runtime defaults in the XML, like vnc listen/socket
      */
     VIR_DEBUG("Setting current domain def as transient");
-    if (virDomainObjSetDefTransient(caps, driver->xmlopt, vm, true) < 0)
+    if (virDomainObjSetDefTransient(caps, driver->xmlopt, vm) < 0)
         goto stop;
 
     if (!(flags & VIR_QEMU_PROCESS_START_PRETEND)) {
@@ -5944,7 +5944,7 @@ int qemuProcessAttach(virConnectPtr conn ATTRIBUTE_UNUSED,
      * report implicit runtime defaults in the XML, like vnc listen/socket
      */
     VIR_DEBUG("Setting current domain def as transient");
-    if (virDomainObjSetDefTransient(caps, driver->xmlopt, vm, true) < 0)
+    if (virDomainObjSetDefTransient(caps, driver->xmlopt, vm) < 0)
         goto error;
 
     vm->def->id = qemuDriverAllocateID(driver);
index a51eb0999309fefc01609c128d788a5f5948dc40..fb40e87c620c8270649605b8412b5654affc0b4a 100644 (file)
@@ -601,7 +601,7 @@ testDomainStartState(testDriverPtr privconn,
 
     if (virDomainObjSetDefTransient(privconn->caps,
                                     privconn->xmlopt,
-                                    dom, false) < 0) {
+                                    dom) < 0) {
         goto cleanup;
     }
 
index d68054e0aae939c69778935f42de7f32b93f72c8..a674c1203ecd343d65e72790d18c2bc166d6bef9 100644 (file)
@@ -1099,8 +1099,7 @@ static int umlStartVMDaemon(virConnectPtr conn,
      * report implicit runtime defaults in the XML, like vnc listen/socket
      */
     VIR_DEBUG("Setting current domain def as transient");
-    if (virDomainObjSetDefTransient(driver->caps, driver->xmlopt,
-                                    vm, true) < 0) {
+    if (virDomainObjSetDefTransient(driver->caps, driver->xmlopt, vm) < 0) {
         VIR_FORCE_CLOSE(logfd);
         return -1;
     }