]> xenbits.xensource.com Git - libvirt.git/commitdiff
vz: fixed race in vzDomainAttach/DettachDevice
authorOlga Krishtal <okrishtal@virtuozzo.com>
Thu, 18 Aug 2016 11:57:14 +0000 (14:57 +0300)
committerMaxim Nestratov <mnestratov@virtuozzo.com>
Fri, 26 Aug 2016 14:48:12 +0000 (17:48 +0300)
While dettaching/attaching device in OpenStack, nova
calls vzDomainDettachDevice twice, because the update of the internal
configuration of the ct comes a bit latter than the update event.
As the result, we suffer from the second call to dettach the same device.

Signed-off-by: Olga Krishtal <okrishtal@virtuozzo.com>
src/vz/vz_sdk.c

index 97fdf91a564f75ac47d9f85e5e08c74d356f761c..46ded57754cba88c729bd630a4b7a89f34f803d0 100644 (file)
@@ -3600,6 +3600,12 @@ prlsdkAttachDevice(vzDriverPtr driver,
         return -1;
     }
 
+    if (prlsdkUpdateDomain(driver, dom) < 0) {
+        virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                        _("Failed to save new config"));
+        return -1;
+    }
+
     job = PrlVm_CommitEx(privdom->sdkdom, PVCF_DETACH_HDD_BUNDLE);
     if (PRL_FAILED(waitDomainJob(job, dom)))
         return -1;
@@ -3667,6 +3673,12 @@ prlsdkDetachDevice(vzDriverPtr driver,
         goto cleanup;
     }
 
+    if (prlsdkUpdateDomain(driver, dom) < 0) {
+        virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                        _("Failed to save new config"));
+        goto cleanup;
+    }
+
     job = PrlVm_CommitEx(privdom->sdkdom, PVCF_DETACH_HDD_BUNDLE);
     if (PRL_FAILED(waitDomainJob(job, dom)))
         goto cleanup;