]> xenbits.xensource.com Git - libvirt.git/commitdiff
vz: fixed race in vzDomainAttach/DettachDevice
authorOlga Krishtal <okrishtal@virtuozzo.com>
Thu, 18 Aug 2016 12:37:00 +0000 (15:37 +0300)
committerMaxim Nestratov <mnestratov@virtuozzo.com>
Thu, 18 Aug 2016 17:37:09 +0000 (20:37 +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_driver.c

index 2ed12db10a9f413afbd5764e11fd4312576299a5..26b14a21f36229566db7686b9ced79428013c2ac 100644 (file)
@@ -1193,6 +1193,9 @@ static int vzDomainAttachDeviceFlags(virDomainPtr domain, const char *xml,
     if (prlsdkAttachDevice(driver, dom, dev) < 0)
         goto cleanup;
 
+    if (prlsdkUpdateDomain(driver, dom) < 0)
+        goto cleanup;
+
     ret = 0;
  cleanup:
     virDomainDeviceDefFree(dev);
@@ -1245,6 +1248,9 @@ static int vzDomainDetachDeviceFlags(virDomainPtr domain, const char *xml,
     if (prlsdkDetachDevice(driver, dom, dev) < 0)
         goto cleanup;
 
+    if (prlsdkUpdateDomain(driver, dom) < 0)
+        goto cleanup;
+
     ret = 0;
  cleanup:
     virDomainDeviceDefFree(dev);