On 18.08.2016 14:57, Olga Krishtal wrote:
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(a)virtuozzo.com>
---
src/vz/vz_sdk.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/src/vz/vz_sdk.c b/src/vz/vz_sdk.c
index 68dd5b5..9fbf968 100644
--- a/src/vz/vz_sdk.c
+++ b/src/vz/vz_sdk.c
@@ -3594,6 +3594,12 @@ prlsdkAttachDevice(vzDriverPtr driver,
return -1;
}
+ if (prlsdkUpdateDomain(driver, dom) < 0) {
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Failed to save new config"));
+ return -1;
+ }
+
I suggest to call prlsdkUpdateDomain from vzDomainDetachDeviceFlags and
vzDomainAttachDeviceFlags.
Example for vzDomainAttachDeviceFlags():
if (vzEnsureDomainExists(dom) < 0)
goto cleanup;
if (prlsdkAttachDevice(driver, dom, dev) < 0)
goto cleanup;
+ if (prlsdkUpdateDomain(driver, dom) < 0)
+ goto cleanup;
ret = 0;
cleanup:
virDomainDeviceDefFree(dev);
if (job)
vzDomainObjEndJob(dom);
job = PrlVm_CommitEx(privdom->sdkdom,
PVCF_DETACH_HDD_BUNDLE);
if (PRL_FAILED(waitDomainJob(job, dom)))
return -1;
@@ -3661,6 +3667,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;