[libvirt] [PATCH] esx: Update ID after starting a domain

--- src/esx/esx_driver.c | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/esx/esx_driver.c b/src/esx/esx_driver.c index eb64556..964a3a5 100644 --- a/src/esx/esx_driver.c +++ b/src/esx/esx_driver.c @@ -2483,6 +2483,7 @@ esxDomainCreateWithFlags(virDomainPtr domain, unsigned int flags) esxVI_ObjectContent *virtualMachine = NULL; esxVI_String *propertyNameList = NULL; esxVI_VirtualMachinePowerState powerState; + int id = -1; esxVI_ManagedObjectReference *task = NULL; esxVI_TaskInfoState taskInfoState; @@ -2497,8 +2498,8 @@ esxDomainCreateWithFlags(virDomainPtr domain, unsigned int flags) esxVI_LookupVirtualMachineByUuidAndPrepareForTask (priv->primary, domain->uuid, propertyNameList, &virtualMachine, priv->autoAnswer) < 0 || - esxVI_GetVirtualMachinePowerState(virtualMachine, - &powerState) < 0) { + esxVI_GetVirtualMachinePowerState(virtualMachine, &powerState) < 0 || + esxVI_GetVirtualMachineIdentity(virtualMachine, &id, NULL, NULL) < 0) { goto cleanup; } @@ -2521,6 +2522,7 @@ esxDomainCreateWithFlags(virDomainPtr domain, unsigned int flags) goto cleanup; } + domain->id = id; result = 0; cleanup: -- 1.7.0.4

On 07/30/2010 09:23 AM, Matthias Bolte wrote:
--- src/esx/esx_driver.c | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/esx/esx_driver.c b/src/esx/esx_driver.c index eb64556..964a3a5 100644 --- a/src/esx/esx_driver.c +++ b/src/esx/esx_driver.c @@ -2483,6 +2483,7 @@ esxDomainCreateWithFlags(virDomainPtr domain, unsigned int flags) esxVI_ObjectContent *virtualMachine = NULL; esxVI_String *propertyNameList = NULL; esxVI_VirtualMachinePowerState powerState; + int id = -1; esxVI_ManagedObjectReference *task = NULL; esxVI_TaskInfoState taskInfoState;
@@ -2497,8 +2498,8 @@ esxDomainCreateWithFlags(virDomainPtr domain, unsigned int flags) esxVI_LookupVirtualMachineByUuidAndPrepareForTask (priv->primary, domain->uuid, propertyNameList, &virtualMachine, priv->autoAnswer) < 0 || - esxVI_GetVirtualMachinePowerState(virtualMachine, - &powerState) < 0) { + esxVI_GetVirtualMachinePowerState(virtualMachine, &powerState) < 0 || + esxVI_GetVirtualMachineIdentity(virtualMachine, &id, NULL, NULL) < 0) {
ACK. This leaves domain->id unchanged on failure, but I think that's okay, because the caller shouldn't be relying on the contents of domain on failure. -- Eric Blake eblake@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org

2010/7/30 Eric Blake <eblake@redhat.com>:
On 07/30/2010 09:23 AM, Matthias Bolte wrote:
--- src/esx/esx_driver.c | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/esx/esx_driver.c b/src/esx/esx_driver.c index eb64556..964a3a5 100644 --- a/src/esx/esx_driver.c +++ b/src/esx/esx_driver.c @@ -2483,6 +2483,7 @@ esxDomainCreateWithFlags(virDomainPtr domain, unsigned int flags) esxVI_ObjectContent *virtualMachine = NULL; esxVI_String *propertyNameList = NULL; esxVI_VirtualMachinePowerState powerState; + int id = -1; esxVI_ManagedObjectReference *task = NULL; esxVI_TaskInfoState taskInfoState;
@@ -2497,8 +2498,8 @@ esxDomainCreateWithFlags(virDomainPtr domain, unsigned int flags) esxVI_LookupVirtualMachineByUuidAndPrepareForTask (priv->primary, domain->uuid, propertyNameList, &virtualMachine, priv->autoAnswer) < 0 || - esxVI_GetVirtualMachinePowerState(virtualMachine, - &powerState) < 0) { + esxVI_GetVirtualMachinePowerState(virtualMachine, &powerState) < 0 || + esxVI_GetVirtualMachineIdentity(virtualMachine, &id, NULL, NULL) < 0) {
ACK. This leaves domain->id unchanged on failure, but I think that's okay, because the caller shouldn't be relying on the contents of domain on failure.
Thanks, pushed. Matthias
participants (2)
-
Eric Blake
-
Matthias Bolte