[libvirt] [PATCH] Remove undefined symbols from symbols file
by Matthias Bolte
---
src/libvirt_private.syms | 7 +------
1 files changed, 1 insertions(+), 6 deletions(-)
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 814e2d8..b76f2da 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -209,7 +209,6 @@ virDomainTimerModeTypeFromString;
virDomainSnapshotObjListGetNames;
virDomainSnapshotObjListNum;
virDomainSnapshotFindByName;
-virDomainSnapshotObjListAdd;
virDomainSnapshotObjListRemove;
virDomainSnapshotHasChildren;
virDomainSnapshotObjUnref;
@@ -516,11 +515,7 @@ virNWFilterInstantiateFilter;
virNWFilterTeardownFilter;
-#nwfilter_learnipaddr.h
-ipAddressMap;
-ipAddressMapLock;
-pendingLearnReq;
-pendingLearnReqLock;
+# nwfilter_learnipaddr.h
virNWFilterGetIpAddrForIfname;
virNWFilterDelIpAddrForIfname;
virNWFilterLookupLearnReq;
--
1.6.3.3
14 years, 7 months
[libvirt] [PATCH] esx: Add domain snapshot support
by Matthias Bolte
Fix invalid code generating in esx_vi_generator.py regarding deep copy
types that contain enum properties.
Add strptime and timegm to bootstrap.conf. Both are used to convert a
xsd:dateTime to calendar time.
---
bootstrap.conf | 2 +
src/esx/esx_driver.c | 468 +++++++++++++++++++++++++++++++++++++---
src/esx/esx_vi.c | 290 +++++++++++++++++++++++++
src/esx/esx_vi.h | 27 +++
src/esx/esx_vi_generator.input | 12 +
src/esx/esx_vi_generator.py | 25 ++-
src/esx/esx_vi_methods.c | 86 ++++++++
src/esx/esx_vi_methods.h | 14 ++
src/esx/esx_vi_types.c | 99 +++++++++
src/esx/esx_vi_types.h | 12 +
10 files changed, 990 insertions(+), 45 deletions(-)
diff --git a/bootstrap.conf b/bootstrap.conf
index ac2f8e6..ca9332d 100644
--- a/bootstrap.conf
+++ b/bootstrap.conf
@@ -52,9 +52,11 @@ stpcpy
strchrnul
strndup
strerror
+strptime
strsep
sys_stat
time_r
+timegm
useless-if-before-free
vasprintf
verify
diff --git a/src/esx/esx_driver.c b/src/esx/esx_driver.c
index eb06555..5272654 100644
--- a/src/esx/esx_driver.c
+++ b/src/esx/esx_driver.c
@@ -563,6 +563,7 @@ esxClose(virConnectPtr conn)
esxVI_Logout(priv->host) < 0) {
result = -1;
}
+
esxVI_Context_Free(&priv->host);
if (priv->vCenter != NULL) {
@@ -570,6 +571,7 @@ esxClose(virConnectPtr conn)
esxVI_Logout(priv->vCenter) < 0) {
result = -1;
}
+
esxVI_Context_Free(&priv->vCenter);
}
@@ -1742,23 +1744,8 @@ esxDomainGetInfo(virDomainPtr domain, virDomainInfoPtr info)
goto failure;
}
- switch (powerState) {
- case esxVI_VirtualMachinePowerState_PoweredOff:
- info->state = VIR_DOMAIN_SHUTOFF;
- break;
-
- case esxVI_VirtualMachinePowerState_PoweredOn:
- info->state = VIR_DOMAIN_RUNNING;
- break;
-
- case esxVI_VirtualMachinePowerState_Suspended:
- info->state = VIR_DOMAIN_PAUSED;
- break;
-
- default:
- info->state = VIR_DOMAIN_NOSTATE;
- break;
- }
+ info->state = esxVI_VirtualMachinePowerState_ConvertToLibvirt
+ (powerState);
} else if (STREQ(dynamicProperty->name, "config.hardware.memoryMB")) {
if (esxVI_AnyType_ExpectType(dynamicProperty->val,
esxVI_Type_Int) < 0) {
@@ -2329,7 +2316,6 @@ esxListDefinedDomains(virConnectPtr conn, char **const names, int maxnames)
count = -1;
goto cleanup;
-
}
@@ -3308,6 +3294,418 @@ esxDomainIsPersistent(virDomainPtr domain ATTRIBUTE_UNUSED)
+static virDomainSnapshotPtr
+esxDomainSnapshotCreateXML(virDomainPtr domain, const char *xmlDesc,
+ unsigned int flags ATTRIBUTE_UNUSED)
+{
+ esxPrivate *priv = domain->conn->privateData;
+ virDomainSnapshotDefPtr def = NULL;
+ esxVI_ObjectContent *virtualMachine = NULL;
+ esxVI_VirtualMachineSnapshotTree *rootSnapshotList = NULL;
+ esxVI_VirtualMachineSnapshotTree *snapshotTree = NULL;
+ esxVI_VirtualMachineSnapshotTree *snapshotTreeParent = NULL;
+ esxVI_ManagedObjectReference *task = NULL;
+ esxVI_TaskInfoState taskInfoState;
+ virDomainSnapshotPtr snapshot = NULL;
+
+ if (esxVI_EnsureSession(priv->host) < 0) {
+ goto failure;
+ }
+
+ def = virDomainSnapshotDefParseString(xmlDesc, 1);
+
+ if (def == NULL) {
+ goto failure;
+ }
+
+ if (esxVI_LookupVirtualMachineByUuidAndPrepareForTask
+ (priv->host, domain->uuid, NULL, &virtualMachine,
+ priv->autoAnswer) < 0 ||
+ esxVI_LookupRootSnapshotTreeList(priv->host, domain->uuid,
+ &rootSnapshotList) < 0 ||
+ esxVI_GetSnapshotTreeByName(rootSnapshotList, def->name,
+ &snapshotTree, &snapshotTreeParent,
+ esxVI_Occurrence_OptionalItem) < 0) {
+ goto failure;
+ }
+
+ if (snapshotTree != NULL) {
+ ESX_ERROR(VIR_ERR_OPERATION_INVALID,
+ _("Snapshot '%s' already exists"), def->name);
+ goto failure;
+ }
+
+ if (esxVI_CreateSnapshot_Task(priv->host, virtualMachine->obj,
+ def->name, def->description,
+ esxVI_Boolean_True,
+ esxVI_Boolean_False, &task) < 0 ||
+ esxVI_WaitForTaskCompletion(priv->host, task, domain->uuid,
+ priv->autoAnswer, &taskInfoState) < 0) {
+ goto failure;
+ }
+
+ if (taskInfoState != esxVI_TaskInfoState_Success) {
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Could not create snapshot"));
+ goto failure;
+ }
+
+ snapshot = virGetDomainSnapshot(domain, def->name);
+
+ cleanup:
+ virDomainSnapshotDefFree(def);
+ esxVI_ObjectContent_Free(&virtualMachine);
+ esxVI_VirtualMachineSnapshotTree_Free(&rootSnapshotList);
+ esxVI_ManagedObjectReference_Free(&task);
+
+ return snapshot;
+
+ failure:
+ domain = NULL;
+
+ goto cleanup;
+}
+
+
+
+static char *
+esxDomainSnapshotDumpXML(virDomainSnapshotPtr snapshot,
+ unsigned int flags ATTRIBUTE_UNUSED)
+{
+ esxPrivate *priv = snapshot->domain->conn->privateData;
+ esxVI_VirtualMachineSnapshotTree *rootSnapshotList = NULL;
+ esxVI_VirtualMachineSnapshotTree *snapshotTree = NULL;
+ esxVI_VirtualMachineSnapshotTree *snapshotTreeParent = NULL;
+ virDomainSnapshotDef def;
+ char uuid_string[VIR_UUID_STRING_BUFLEN] = "";
+ char *xml = NULL;
+
+ memset(&def, 0, sizeof (virDomainSnapshotDef));
+
+ if (esxVI_EnsureSession(priv->host) < 0) {
+ goto failure;
+ }
+
+ if (esxVI_LookupRootSnapshotTreeList(priv->host, snapshot->domain->uuid,
+ &rootSnapshotList) < 0 ||
+ esxVI_GetSnapshotTreeByName(rootSnapshotList, snapshot->name,
+ &snapshotTree, &snapshotTreeParent,
+ esxVI_Occurrence_RequiredItem) < 0) {
+ goto failure;
+ }
+
+ def.name = snapshot->name;
+ def.description = snapshotTree->description;
+ def.parent = snapshotTreeParent != NULL ? snapshotTreeParent->name : NULL;
+
+ if (esxVI_DateTime_ConvertToCalendarTime(snapshotTree->createTime,
+ &def.creationTime) < 0) {
+ goto failure;
+ }
+
+ def.state = esxVI_VirtualMachinePowerState_ConvertToLibvirt
+ (snapshotTree->state);
+
+ virUUIDFormat(snapshot->domain->uuid, uuid_string);
+
+ xml = virDomainSnapshotDefFormat(uuid_string, &def, 0);
+
+ cleanup:
+ esxVI_VirtualMachineSnapshotTree_Free(&rootSnapshotList);
+
+ return xml;
+
+ failure:
+ VIR_FREE(xml);
+
+ goto cleanup;
+}
+
+
+
+static int
+esxDomainSnapshotNum(virDomainPtr domain, unsigned int flags ATTRIBUTE_UNUSED)
+{
+ int result = 0;
+ esxPrivate *priv = domain->conn->privateData;
+ esxVI_VirtualMachineSnapshotTree *rootSnapshotTreeList = NULL;
+
+ if (esxVI_EnsureSession(priv->host) < 0) {
+ goto failure;
+ }
+
+ if (esxVI_LookupRootSnapshotTreeList(priv->host, domain->uuid,
+ &rootSnapshotTreeList) < 0) {
+ goto failure;
+ }
+
+ result = esxVI_GetNumberOfSnapshotTrees(rootSnapshotTreeList);
+
+ cleanup:
+ esxVI_VirtualMachineSnapshotTree_Free(&rootSnapshotTreeList);
+
+ return result;
+
+ failure:
+ result = -1;
+
+ goto cleanup;
+}
+
+
+
+static int
+esxDomainSnapshotListNames(virDomainPtr domain, char **names, int nameslen,
+ unsigned int flags ATTRIBUTE_UNUSED)
+{
+ int result = 0;
+ esxPrivate *priv = domain->conn->privateData;
+ esxVI_VirtualMachineSnapshotTree *rootSnapshotTreeList = NULL;
+
+ if (names == NULL || nameslen < 0) {
+ ESX_ERROR(VIR_ERR_INVALID_ARG, "%s", _("Invalid argument"));
+ return -1;
+ }
+
+ if (nameslen == 0) {
+ return 0;
+ }
+
+ if (esxVI_EnsureSession(priv->host) < 0) {
+ goto failure;
+ }
+
+ if (esxVI_LookupRootSnapshotTreeList(priv->host, domain->uuid,
+ &rootSnapshotTreeList) < 0) {
+ goto failure;
+ }
+
+ result = esxVI_GetSnapshotTreeNames(rootSnapshotTreeList, names, nameslen);
+
+ cleanup:
+ esxVI_VirtualMachineSnapshotTree_Free(&rootSnapshotTreeList);
+
+ return result;
+
+ failure:
+ result = -1;
+
+ goto cleanup;
+}
+
+
+
+static virDomainSnapshotPtr
+esxDomainSnapshotLookupByName(virDomainPtr domain, const char *name,
+ unsigned int flags ATTRIBUTE_UNUSED)
+{
+ esxPrivate *priv = domain->conn->privateData;
+ esxVI_VirtualMachineSnapshotTree *rootSnapshotTreeList = NULL;
+ esxVI_VirtualMachineSnapshotTree *snapshotTree = NULL;
+ esxVI_VirtualMachineSnapshotTree *snapshotTreeParent = NULL;
+ virDomainSnapshotPtr snapshot = NULL;
+
+ if (esxVI_EnsureSession(priv->host) < 0) {
+ goto failure;
+ }
+
+ if (esxVI_LookupRootSnapshotTreeList(priv->host, domain->uuid,
+ &rootSnapshotTreeList) < 0 ||
+ esxVI_GetSnapshotTreeByName(rootSnapshotTreeList, name, &snapshotTree,
+ &snapshotTreeParent,
+ esxVI_Occurrence_RequiredItem) < 0) {
+ goto failure;
+ }
+
+ snapshot = virGetDomainSnapshot(domain, name);
+
+ cleanup:
+ esxVI_VirtualMachineSnapshotTree_Free(&rootSnapshotTreeList);
+
+ return snapshot;
+
+ failure:
+ snapshot = NULL;
+
+ goto cleanup;
+}
+
+
+
+static int
+esxDomainHasCurrentSnapshot(virDomainPtr domain,
+ unsigned int flags ATTRIBUTE_UNUSED)
+{
+ int result = 0;
+ esxPrivate *priv = domain->conn->privateData;
+ esxVI_VirtualMachineSnapshotTree *currentSnapshotTree = NULL;
+
+ if (esxVI_EnsureSession(priv->host) < 0) {
+ goto failure;
+ }
+
+ if (esxVI_LookupCurrentSnapshotTree(priv->host, domain->uuid,
+ ¤tSnapshotTree,
+ esxVI_Occurrence_OptionalItem) < 0) {
+ goto failure;
+ }
+
+ if (currentSnapshotTree != NULL) {
+ result = 1;
+ }
+
+ cleanup:
+ esxVI_VirtualMachineSnapshotTree_Free(¤tSnapshotTree);
+
+ return result;
+
+ failure:
+ result = -1;
+
+ goto cleanup;
+}
+
+
+
+static virDomainSnapshotPtr
+esxDomainSnapshotCurrent(virDomainPtr domain,
+ unsigned int flags ATTRIBUTE_UNUSED)
+{
+
+ virDomainSnapshotPtr snapshot = NULL;
+ esxPrivate *priv = domain->conn->privateData;
+ esxVI_VirtualMachineSnapshotTree *currentSnapshotTree = NULL;
+
+ if (esxVI_EnsureSession(priv->host) < 0) {
+ goto failure;
+ }
+
+ if (esxVI_LookupCurrentSnapshotTree(priv->host, domain->uuid,
+ ¤tSnapshotTree,
+ esxVI_Occurrence_RequiredItem) < 0) {
+ goto failure;
+ }
+
+ snapshot = virGetDomainSnapshot(domain, currentSnapshotTree->name);
+
+ cleanup:
+ esxVI_VirtualMachineSnapshotTree_Free(¤tSnapshotTree);
+
+ return snapshot;
+
+ failure:
+ snapshot = NULL;
+
+ goto cleanup;
+}
+
+
+
+static int
+esxDomainRevertToSnapshot(virDomainSnapshotPtr snapshot,
+ unsigned int flags ATTRIBUTE_UNUSED)
+{
+ int result = 0;
+ esxPrivate *priv = snapshot->domain->conn->privateData;
+ esxVI_VirtualMachineSnapshotTree *rootSnapshotList = NULL;
+ esxVI_VirtualMachineSnapshotTree *snapshotTree = NULL;
+ esxVI_VirtualMachineSnapshotTree *snapshotTreeParent = NULL;
+ esxVI_ManagedObjectReference *task = NULL;
+ esxVI_TaskInfoState taskInfoState;
+
+ if (esxVI_EnsureSession(priv->host) < 0) {
+ goto failure;
+ }
+
+ if (esxVI_LookupRootSnapshotTreeList(priv->host, snapshot->domain->uuid,
+ &rootSnapshotList) < 0 ||
+ esxVI_GetSnapshotTreeByName(rootSnapshotList, snapshot->name,
+ &snapshotTree, &snapshotTreeParent,
+ esxVI_Occurrence_RequiredItem) < 0) {
+ goto failure;
+ }
+
+ if (esxVI_RevertToSnapshot_Task(priv->host, snapshotTree->snapshot, NULL,
+ &task) < 0 ||
+ esxVI_WaitForTaskCompletion(priv->host, task, snapshot->domain->uuid,
+ priv->autoAnswer, &taskInfoState) < 0) {
+ goto failure;
+ }
+
+ if (taskInfoState != esxVI_TaskInfoState_Success) {
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
+ _("Could not revert to snapshot '%s'"), snapshot->name);
+ goto failure;
+ }
+
+ cleanup:
+ esxVI_VirtualMachineSnapshotTree_Free(&rootSnapshotList);
+ esxVI_ManagedObjectReference_Free(&task);
+
+ return result;
+
+ failure:
+ result = -1;
+
+ goto cleanup;
+}
+
+
+
+static int
+esxDomainSnapshotDelete(virDomainSnapshotPtr snapshot, unsigned int flags)
+{
+ int result = 0;
+ esxPrivate *priv = snapshot->domain->conn->privateData;
+ esxVI_VirtualMachineSnapshotTree *rootSnapshotList = NULL;
+ esxVI_VirtualMachineSnapshotTree *snapshotTree = NULL;
+ esxVI_VirtualMachineSnapshotTree *snapshotTreeParent = NULL;
+ esxVI_Boolean removeChildren = esxVI_Boolean_False;
+ esxVI_ManagedObjectReference *task = NULL;
+ esxVI_TaskInfoState taskInfoState;
+
+ if (esxVI_EnsureSession(priv->host) < 0) {
+ goto failure;
+ }
+
+ if (flags & VIR_DOMAIN_SNAPSHOT_DELETE_CHILDREN) {
+ removeChildren = esxVI_Boolean_True;
+ }
+
+ if (esxVI_LookupRootSnapshotTreeList(priv->host, snapshot->domain->uuid,
+ &rootSnapshotList) < 0 ||
+ esxVI_GetSnapshotTreeByName(rootSnapshotList, snapshot->name,
+ &snapshotTree, &snapshotTreeParent,
+ esxVI_Occurrence_RequiredItem) < 0) {
+ goto failure;
+ }
+
+ if (esxVI_RemoveSnapshot_Task(priv->host, snapshotTree->snapshot,
+ removeChildren, &task) < 0 ||
+ esxVI_WaitForTaskCompletion(priv->host, task, snapshot->domain->uuid,
+ priv->autoAnswer, &taskInfoState) < 0) {
+ goto failure;
+ }
+
+ if (taskInfoState != esxVI_TaskInfoState_Success) {
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
+ _("Could not delete snapshot '%s'"), snapshot->name);
+ goto failure;
+ }
+
+ cleanup:
+ esxVI_VirtualMachineSnapshotTree_Free(&rootSnapshotList);
+ esxVI_ManagedObjectReference_Free(&task);
+
+ return result;
+
+ failure:
+ result = -1;
+
+ goto cleanup;
+}
+
+
+
static virDriver esxDriver = {
VIR_DRV_ESX,
"ESX",
@@ -3388,23 +3786,23 @@ static virDriver esxDriver = {
esxDomainIsPersistent, /* domainIsPersistent */
NULL, /* cpuCompare */
NULL, /* cpuBaseline */
- NULL, /* domainGetJobInfo */
- NULL, /* domainAbortJob */
- NULL, /* domainMigrateSetMaxDowntime */
- NULL, /* domainEventRegisterAny */
- NULL, /* domainEventDeregisterAny */
- NULL, /* domainManagedSave */
- NULL, /* domainHasManagedSaveImage */
- NULL, /* domainManagedSaveRemove */
- NULL, /* domainSnapshotCreateXML */
- NULL, /* domainSnapshotDumpXML */
- NULL, /* domainSnapshotNum */
- NULL, /* domainSnapshotListNames */
- NULL, /* domainSnapshotLookupByName */
- NULL, /* domainHasCurrentSnapshot */
- NULL, /* domainSnapshotCurrent */
- NULL, /* domainRevertToSnapshot */
- NULL, /* domainSnapshotDelete */
+ NULL, /* domainGetJobInfo */
+ NULL, /* domainAbortJob */
+ NULL, /* domainMigrateSetMaxDowntime */
+ NULL, /* domainEventRegisterAny */
+ NULL, /* domainEventDeregisterAny */
+ NULL, /* domainManagedSave */
+ NULL, /* domainHasManagedSaveImage */
+ NULL, /* domainManagedSaveRemove */
+ esxDomainSnapshotCreateXML, /* domainSnapshotCreateXML */
+ esxDomainSnapshotDumpXML, /* domainSnapshotDumpXML */
+ esxDomainSnapshotNum, /* domainSnapshotNum */
+ esxDomainSnapshotListNames, /* domainSnapshotListNames */
+ esxDomainSnapshotLookupByName, /* domainSnapshotLookupByName */
+ esxDomainHasCurrentSnapshot, /* domainHasCurrentSnapshot */
+ esxDomainSnapshotCurrent, /* domainSnapshotCurrent */
+ esxDomainRevertToSnapshot, /* domainRevertToSnapshot */
+ esxDomainSnapshotDelete, /* domainSnapshotDelete */
};
diff --git a/src/esx/esx_vi.c b/src/esx/esx_vi.c
index c37dfa1..eb5371d 100644
--- a/src/esx/esx_vi.c
+++ b/src/esx/esx_vi.c
@@ -1719,6 +1719,152 @@ esxVI_GetVirtualMachineIdentity(esxVI_ObjectContent *virtualMachine,
int
+esxVI_GetNumberOfSnapshotTrees
+ (esxVI_VirtualMachineSnapshotTree *snapshotTreeList)
+{
+ int count = 0;
+ esxVI_VirtualMachineSnapshotTree *snapshotTree;
+
+ for (snapshotTree = snapshotTreeList; snapshotTree != NULL;
+ snapshotTree = snapshotTree->_next) {
+ count += 1 + esxVI_GetNumberOfSnapshotTrees
+ (snapshotTree->childSnapshotList);
+ }
+
+ return count;
+}
+
+
+
+int
+esxVI_GetSnapshotTreeNames(esxVI_VirtualMachineSnapshotTree *snapshotTreeList,
+ char **names, int nameslen)
+{
+ int count = 0;
+ int result;
+ int i;
+ esxVI_VirtualMachineSnapshotTree *snapshotTree;
+
+ for (snapshotTree = snapshotTreeList;
+ snapshotTree != NULL && count < nameslen;
+ snapshotTree = snapshotTree->_next) {
+ names[count] = strdup(snapshotTree->name);
+
+ if (names[count] == NULL) {
+ virReportOOMError();
+ goto failure;
+ }
+
+ count++;
+
+ if (count >= nameslen) {
+ break;
+ }
+
+ result = esxVI_GetSnapshotTreeNames(snapshotTree->childSnapshotList,
+ names + count, nameslen - count);
+
+ if (result < 0) {
+ goto failure;
+ }
+
+ count += result;
+ }
+
+ return count;
+
+ failure:
+ for (i = 0; i < count; ++i) {
+ VIR_FREE(names[i]);
+ }
+
+ return -1;
+}
+
+
+
+int
+esxVI_GetSnapshotTreeByName
+ (esxVI_VirtualMachineSnapshotTree *snapshotTreeList, const char *name,
+ esxVI_VirtualMachineSnapshotTree **snapshotTree,
+ esxVI_VirtualMachineSnapshotTree **snapshotTreeParent,
+ esxVI_Occurrence occurrence)
+{
+ esxVI_VirtualMachineSnapshotTree *candidate;
+
+ if (snapshotTree == NULL || *snapshotTree != NULL ||
+ snapshotTreeParent == NULL || *snapshotTreeParent != NULL) {
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
+ return -1;
+ }
+
+ for (candidate = snapshotTreeList; candidate != NULL;
+ candidate = candidate->_next) {
+ if (STREQ(candidate->name, name)) {
+ *snapshotTree = candidate;
+ *snapshotTreeParent = NULL;
+ return 1;
+ }
+
+ if (esxVI_GetSnapshotTreeByName(candidate->childSnapshotList, name,
+ snapshotTree, snapshotTreeParent,
+ occurrence) > 0) {
+ if (*snapshotTreeParent == NULL) {
+ *snapshotTreeParent = candidate;
+ }
+
+ return 1;
+ }
+ }
+
+ if (occurrence == esxVI_Occurrence_OptionalItem) {
+ return 0;
+ } else {
+ ESX_VI_ERROR(VIR_ERR_NO_DOMAIN_SNAPSHOT,
+ _("Could not find snapshot with name '%s'"), name);
+
+ return -1;
+ }
+}
+
+
+
+int
+esxVI_GetSnapshotTreeBySnapshot
+ (esxVI_VirtualMachineSnapshotTree *snapshotTreeList,
+ esxVI_ManagedObjectReference *snapshot,
+ esxVI_VirtualMachineSnapshotTree **snapshotTree)
+{
+ esxVI_VirtualMachineSnapshotTree *candidate;
+
+ if (snapshotTree == NULL || *snapshotTree != NULL) {
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
+ return -1;
+ }
+
+ for (candidate = snapshotTreeList; candidate != NULL;
+ candidate = candidate->_next) {
+ if (STREQ(candidate->snapshot->value, snapshot->value)) {
+ *snapshotTree = candidate;
+ return 0;
+ }
+
+ if (esxVI_GetSnapshotTreeBySnapshot(candidate->childSnapshotList,
+ snapshot, snapshotTree) >= 0) {
+ return 0;
+ }
+ }
+
+ ESX_VI_ERROR(VIR_ERR_NO_DOMAIN_SNAPSHOT,
+ _("Could not find domain snapshot with internal name '%s'"),
+ snapshot->value);
+
+ return -1;
+}
+
+
+
+int
esxVI_LookupResourcePoolByHostSystem
(esxVI_Context *ctx, esxVI_ObjectContent *hostSystem,
esxVI_ManagedObjectReference **resourcePool)
@@ -2336,6 +2482,150 @@ esxVI_LookupAndHandleVirtualMachineQuestion(esxVI_Context *ctx,
int
+esxVI_LookupRootSnapshotTreeList
+ (esxVI_Context *ctx, const unsigned char *virtualMachineUuid,
+ esxVI_VirtualMachineSnapshotTree **rootSnapshotTreeList)
+{
+ int result = 0;
+ esxVI_String *propertyNameList = NULL;
+ esxVI_ObjectContent *virtualMachine = NULL;
+ esxVI_DynamicProperty *dynamicProperty = NULL;
+
+ if (rootSnapshotTreeList == NULL || *rootSnapshotTreeList != NULL) {
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
+ return -1;
+ }
+
+ if (esxVI_String_AppendValueToList(&propertyNameList,
+ "snapshot.rootSnapshotList") < 0 ||
+ esxVI_LookupVirtualMachineByUuid(ctx, virtualMachineUuid,
+ propertyNameList, &virtualMachine,
+ esxVI_Occurrence_RequiredItem) < 0) {
+ goto failure;
+ }
+
+ for (dynamicProperty = virtualMachine->propSet; dynamicProperty != NULL;
+ dynamicProperty = dynamicProperty->_next) {
+ if (STREQ(dynamicProperty->name, "snapshot.rootSnapshotList")) {
+ if (esxVI_VirtualMachineSnapshotTree_CastListFromAnyType
+ (dynamicProperty->val, rootSnapshotTreeList) < 0) {
+ goto failure;
+ }
+
+ break;
+ } else {
+ VIR_WARN("Unexpected '%s' property", dynamicProperty->name);
+ }
+ }
+
+ if (*rootSnapshotTreeList == NULL) {
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Could not lookup root snapshot list"));
+ goto failure;
+ }
+
+ cleanup:
+ esxVI_String_Free(&propertyNameList);
+ esxVI_ObjectContent_Free(&virtualMachine);
+
+ return result;
+
+ failure:
+ esxVI_VirtualMachineSnapshotTree_Free(rootSnapshotTreeList);
+
+ result = -1;
+
+ goto cleanup;
+}
+
+
+
+int
+esxVI_LookupCurrentSnapshotTree
+ (esxVI_Context *ctx, const unsigned char *virtualMachineUuid,
+ esxVI_VirtualMachineSnapshotTree **currentSnapshotTree,
+ esxVI_Occurrence occurrence)
+{
+ int result = 0;
+ esxVI_String *propertyNameList = NULL;
+ esxVI_ObjectContent *virtualMachine = NULL;
+ esxVI_DynamicProperty *dynamicProperty = NULL;
+ esxVI_ManagedObjectReference *currentSnapshot = NULL;
+ esxVI_VirtualMachineSnapshotTree *rootSnapshotTreeList = NULL;
+ esxVI_VirtualMachineSnapshotTree *snapshotTree = NULL;
+
+ if (currentSnapshotTree == NULL || *currentSnapshotTree != NULL) {
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
+ return -1;
+ }
+
+ if (esxVI_String_AppendValueListToList(&propertyNameList,
+ "snapshot.currentSnapshot\0"
+ "snapshot.rootSnapshotList\0") < 0 ||
+ esxVI_LookupVirtualMachineByUuid(ctx, virtualMachineUuid,
+ propertyNameList, &virtualMachine,
+ esxVI_Occurrence_RequiredItem) < 0) {
+ goto failure;
+ }
+
+ for (dynamicProperty = virtualMachine->propSet; dynamicProperty != NULL;
+ dynamicProperty = dynamicProperty->_next) {
+ if (STREQ(dynamicProperty->name, "snapshot.currentSnapshot")) {
+ if (esxVI_ManagedObjectReference_CastFromAnyType
+ (dynamicProperty->val, ¤tSnapshot) < 0) {
+ goto failure;
+ }
+ } else if (STREQ(dynamicProperty->name, "snapshot.rootSnapshotList")) {
+ if (esxVI_VirtualMachineSnapshotTree_CastListFromAnyType
+ (dynamicProperty->val, &rootSnapshotTreeList) < 0) {
+ goto failure;
+ }
+ } else {
+ VIR_WARN("Unexpected '%s' property", dynamicProperty->name);
+ }
+ }
+
+ if (currentSnapshot == NULL) {
+ if (occurrence == esxVI_Occurrence_OptionalItem) {
+ return 0;
+ } else {
+ ESX_VI_ERROR(VIR_ERR_NO_DOMAIN_SNAPSHOT, "%s",
+ _("Domain has no current snapshot"));
+ goto failure;
+ }
+ }
+
+ if (rootSnapshotTreeList == NULL) {
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Could not lookup root snapshot list"));
+ goto failure;
+ }
+
+ if (esxVI_GetSnapshotTreeBySnapshot(rootSnapshotTreeList, currentSnapshot,
+ &snapshotTree) < 0 ||
+ esxVI_VirtualMachineSnapshotTree_DeepCopy(currentSnapshotTree,
+ snapshotTree) < 0) {
+ goto failure;
+ }
+
+ cleanup:
+ esxVI_String_Free(&propertyNameList);
+ esxVI_ObjectContent_Free(&virtualMachine);
+ esxVI_ManagedObjectReference_Free(¤tSnapshot);
+ esxVI_VirtualMachineSnapshotTree_Free(&rootSnapshotTreeList);
+
+ return result;
+
+ failure:
+
+ result = -1;
+
+ goto cleanup;
+}
+
+
+
+int
esxVI_HandleVirtualMachineQuestion
(esxVI_Context *ctx, esxVI_ManagedObjectReference *virtualMachine,
esxVI_VirtualMachineQuestionInfo *questionInfo,
diff --git a/src/esx/esx_vi.h b/src/esx/esx_vi.h
index 9b65e85..a8d4cc3 100644
--- a/src/esx/esx_vi.h
+++ b/src/esx/esx_vi.h
@@ -233,6 +233,24 @@ int esxVI_LookupNumberOfDomainsByPowerState
int esxVI_GetVirtualMachineIdentity(esxVI_ObjectContent *virtualMachine,
int *id, char **name, unsigned char *uuid);
+int esxVI_GetNumberOfSnapshotTrees
+ (esxVI_VirtualMachineSnapshotTree *snapshotTreeList);
+
+int esxVI_GetSnapshotTreeNames
+ (esxVI_VirtualMachineSnapshotTree *snapshotTreeList, char **names,
+ int nameslen);
+
+int esxVI_GetSnapshotTreeByName
+ (esxVI_VirtualMachineSnapshotTree *snapshotTreeList, const char *name,
+ esxVI_VirtualMachineSnapshotTree **snapshotTree,
+ esxVI_VirtualMachineSnapshotTree **snapshotTreeParent,
+ esxVI_Occurrence occurrence);
+
+int esxVI_GetSnapshotTreeBySnapshot
+ (esxVI_VirtualMachineSnapshotTree *snapshotTreeList,
+ esxVI_ManagedObjectReference *snapshot,
+ esxVI_VirtualMachineSnapshotTree **snapshotTree);
+
int esxVI_LookupResourcePoolByHostSystem
(esxVI_Context *ctx, esxVI_ObjectContent *hostSystem,
esxVI_ManagedObjectReference **resourcePool);
@@ -274,6 +292,15 @@ int esxVI_LookupAndHandleVirtualMachineQuestion(esxVI_Context *ctx,
const unsigned char *uuid,
esxVI_Boolean autoAnswer);
+int esxVI_LookupRootSnapshotTreeList
+ (esxVI_Context *ctx, const unsigned char *virtualMachineUuid,
+ esxVI_VirtualMachineSnapshotTree **rootSnapshotTreeList);
+
+int esxVI_LookupCurrentSnapshotTree
+ (esxVI_Context *ctx, const unsigned char *virtualMachineUuid,
+ esxVI_VirtualMachineSnapshotTree **currentSnapshotTree,
+ esxVI_Occurrence occurrence);
+
int esxVI_HandleVirtualMachineQuestion
(esxVI_Context *ctx,
esxVI_ManagedObjectReference *virtualMachine,
diff --git a/src/esx/esx_vi_generator.input b/src/esx/esx_vi_generator.input
index 06dddbf..9c545eb 100644
--- a/src/esx/esx_vi_generator.input
+++ b/src/esx/esx_vi_generator.input
@@ -424,3 +424,15 @@ object VirtualMachineQuestionInfo
ChoiceOption choice r
VirtualMachineMessage message i
end
+
+
+object VirtualMachineSnapshotTree
+ ManagedObjectReference snapshot r
+ ManagedObjectReference vm r
+ String name r
+ String description r
+ DateTime createTime r
+ VirtualMachinePowerState state r
+ Boolean quiesced r
+ VirtualMachineSnapshotTree childSnapshotList ol
+end
diff --git a/src/esx/esx_vi_generator.py b/src/esx/esx_vi_generator.py
index 5ca6138..b933d5b 100755
--- a/src/esx/esx_vi_generator.py
+++ b/src/esx/esx_vi_generator.py
@@ -95,6 +95,8 @@ class Property:
return " ESX_VI__TEMPLATE__PROPERTY__DEEP_COPY_LIST(%s, %s)\n" % (self.type, self.name)
elif self.type == "String":
return " ESX_VI__TEMPLATE__PROPERTY__DEEP_COPY_VALUE(String, %s)\n" % self.name
+ elif self.is_enum():
+ return " (*dest)->%s = src->%s;\n" % (self.name, self.name)
else:
return " ESX_VI__TEMPLATE__PROPERTY__DEEP_COPY(%s, %s)\n" % (self.type, self.name)
@@ -841,17 +843,19 @@ additional_object_features = { "Event" : Object.FEATURE__LI
"SharesInfo" : Object.FEATURE__ANY_TYPE,
"TaskInfo" : Object.FEATURE__ANY_TYPE | Object.FEATURE__LIST,
"UserSession" : Object.FEATURE__ANY_TYPE,
- "VirtualMachineQuestionInfo" : Object.FEATURE__ANY_TYPE }
+ "VirtualMachineQuestionInfo" : Object.FEATURE__ANY_TYPE,
+ "VirtualMachineSnapshotTree" : Object.FEATURE__DEEP_COPY | Object.FEATURE__ANY_TYPE }
-removed_object_features = { "DynamicProperty" : Object.FEATURE__SERIALIZE,
- "ObjectContent" : Object.FEATURE__SERIALIZE,
- "ObjectUpdate" : Object.FEATURE__SERIALIZE,
- "PropertyChange" : Object.FEATURE__SERIALIZE,
- "PropertyFilterUpdate" : Object.FEATURE__SERIALIZE,
- "TaskInfo" : Object.FEATURE__SERIALIZE,
- "UpdateSet" : Object.FEATURE__SERIALIZE,
- "VirtualMachineConfigInfo" : Object.FEATURE__SERIALIZE }
+removed_object_features = { "DynamicProperty" : Object.FEATURE__SERIALIZE,
+ "ObjectContent" : Object.FEATURE__SERIALIZE,
+ "ObjectUpdate" : Object.FEATURE__SERIALIZE,
+ "PropertyChange" : Object.FEATURE__SERIALIZE,
+ "PropertyFilterUpdate" : Object.FEATURE__SERIALIZE,
+ "TaskInfo" : Object.FEATURE__SERIALIZE,
+ "UpdateSet" : Object.FEATURE__SERIALIZE,
+ "VirtualMachineConfigInfo" : Object.FEATURE__SERIALIZE,
+ "VirtualMachineSnapshotTree" : Object.FEATURE__SERIALIZE }
@@ -948,7 +952,8 @@ for obj in objects_by_name.values():
if obj.features & Object.FEATURE__DEEP_COPY:
for property in obj.properties:
if property.occurrence != Property.OCCURRENCE__IGNORED and \
- property.type not in predefined_objects:
+ property.type not in predefined_objects and \
+ property.type in objects_by_name:
objects_by_name[property.type].features |= Object.FEATURE__DEEP_COPY
# detect extended_by relation
diff --git a/src/esx/esx_vi_methods.c b/src/esx/esx_vi_methods.c
index 3e095c7..b2b3e8d 100644
--- a/src/esx/esx_vi_methods.c
+++ b/src/esx/esx_vi_methods.c
@@ -491,6 +491,92 @@ ESX_VI__METHOD(RegisterVM_Task,
+/* esxVI_CreateSnapshot_Task */
+ESX_VI__METHOD(CreateSnapshot_Task,
+ (esxVI_Context *ctx,
+ esxVI_ManagedObjectReference *virtualMachine,
+ const char *name, const char *description,
+ esxVI_Boolean memory, esxVI_Boolean quiesce,
+ esxVI_ManagedObjectReference **task),
+ RequiredItem,
+{
+ ESX_VI__METHOD__PARAMETER__CHECK_OUTPUT(task)
+},
+{
+ ESX_VI__METHOD__PARAMETER__REQUIRE_THIS(virtualMachine)
+ ESX_VI__METHOD__PARAMETER__REQUIRE(name)
+ ESX_VI__METHOD__PARAMETER__REQUIRE(memory)
+ ESX_VI__METHOD__PARAMETER__REQUIRE(quiesce)
+},
+{
+ ESX_VI__METHOD__PARAMETER__SERIALIZE_THIS(ManagedObjectReference,
+ virtualMachine)
+ ESX_VI__METHOD__PARAMETER__SERIALIZE_VALUE(String, name)
+ ESX_VI__METHOD__PARAMETER__SERIALIZE_VALUE(String, description)
+ ESX_VI__METHOD__PARAMETER__SERIALIZE(Boolean, memory)
+ ESX_VI__METHOD__PARAMETER__SERIALIZE(Boolean, quiesce)
+},
+{
+ if (esxVI_ManagedObjectReference_Deserialize(response->node, task) < 0) {
+ goto failure;
+ }
+})
+
+
+
+/* esxVI_RevertToSnapshot_Task */
+ESX_VI__METHOD(RevertToSnapshot_Task,
+ (esxVI_Context *ctx,
+ esxVI_ManagedObjectReference *virtualMachineSnapshot,
+ esxVI_ManagedObjectReference *host,
+ esxVI_ManagedObjectReference **task),
+ RequiredItem,
+{
+ ESX_VI__METHOD__PARAMETER__CHECK_OUTPUT(task)
+},
+{
+ ESX_VI__METHOD__PARAMETER__REQUIRE_THIS(virtualMachineSnapshot)
+},
+{
+ ESX_VI__METHOD__PARAMETER__SERIALIZE_THIS(ManagedObjectReference,
+ virtualMachineSnapshot)
+ ESX_VI__METHOD__PARAMETER__SERIALIZE(ManagedObjectReference, host)
+},
+{
+ if (esxVI_ManagedObjectReference_Deserialize(response->node, task) < 0) {
+ goto failure;
+ }
+})
+
+
+
+/* esxVI_RemoveSnapshot_Task */
+ESX_VI__METHOD(RemoveSnapshot_Task,
+ (esxVI_Context *ctx,
+ esxVI_ManagedObjectReference *virtualMachineSnapshot,
+ esxVI_Boolean removeChildren,
+ esxVI_ManagedObjectReference **task),
+ RequiredItem,
+{
+ ESX_VI__METHOD__PARAMETER__CHECK_OUTPUT(task)
+},
+{
+ ESX_VI__METHOD__PARAMETER__REQUIRE_THIS(virtualMachineSnapshot)
+ ESX_VI__METHOD__PARAMETER__REQUIRE(removeChildren)
+},
+{
+ ESX_VI__METHOD__PARAMETER__SERIALIZE_THIS(ManagedObjectReference,
+ virtualMachineSnapshot)
+ ESX_VI__METHOD__PARAMETER__SERIALIZE(Boolean, removeChildren)
+},
+{
+ if (esxVI_ManagedObjectReference_Deserialize(response->node, task) < 0) {
+ goto failure;
+ }
+})
+
+
+
/* esxVI_CancelTask */
ESX_VI__METHOD(CancelTask,
(esxVI_Context *ctx,
diff --git a/src/esx/esx_vi_methods.h b/src/esx/esx_vi_methods.h
index 40bff51..9ff8b4b 100644
--- a/src/esx/esx_vi_methods.h
+++ b/src/esx/esx_vi_methods.h
@@ -80,6 +80,20 @@ int esxVI_RegisterVM_Task(esxVI_Context *ctx,
esxVI_ManagedObjectReference *host,
esxVI_ManagedObjectReference **task);
+int esxVI_CreateSnapshot_Task(esxVI_Context *ctx,
+ esxVI_ManagedObjectReference *virtualMachine,
+ const char *name, const char *description,
+ esxVI_Boolean memory, esxVI_Boolean quiesce,
+ esxVI_ManagedObjectReference **task);
+
+int esxVI_RevertToSnapshot_Task
+ (esxVI_Context *ctx, esxVI_ManagedObjectReference *virtualMachineSnapshot,
+ esxVI_ManagedObjectReference *host, esxVI_ManagedObjectReference **task);
+
+int esxVI_RemoveSnapshot_Task
+ (esxVI_Context *ctx, esxVI_ManagedObjectReference *virtualMachineSnapshot,
+ esxVI_Boolean removeChildren, esxVI_ManagedObjectReference **task);
+
int esxVI_CancelTask(esxVI_Context *ctx, esxVI_ManagedObjectReference *task);
int esxVI_UnregisterVM(esxVI_Context *ctx,
diff --git a/src/esx/esx_vi_types.c b/src/esx/esx_vi_types.c
index a69ea44..40d8b9b 100644
--- a/src/esx/esx_vi_types.c
+++ b/src/esx/esx_vi_types.c
@@ -1177,6 +1177,12 @@ ESX_VI__TEMPLATE__VALIDATE(DateTime,
ESX_VI__TEMPLATE__PROPERTY__REQUIRE(value);
})
+/* esxVI_DateTime_DeepCopy */
+ESX_VI__TEMPLATE__DEEP_COPY(DateTime,
+{
+ ESX_VI__TEMPLATE__PROPERTY__DEEP_COPY_VALUE(String, value)
+})
+
/* esxVI_DateTime_Serialize */
ESX_VI__TEMPLATE__SERIALIZE(DateTime,
{
@@ -1213,6 +1219,72 @@ esxVI_DateTime_Deserialize(xmlNodePtr node, esxVI_DateTime **dateTime)
return -1;
}
+int
+esxVI_DateTime_ConvertToCalendarTime(esxVI_DateTime *dateTime,
+ time_t *secondsSinceEpoch)
+{
+ char value[64] = "";
+ char *tmp;
+ struct tm tm;
+ int milliseconds;
+ char sign;
+ int tz_hours;
+ int tz_minutes;
+ int tz_offset = 0;
+
+ if (dateTime == NULL || secondsSinceEpoch == NULL) {
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
+ return -1;
+ }
+
+ if (virStrcpyStatic(value, dateTime->value) == NULL) {
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
+ _("xsd:dateTime value '%s' too long for destination"),
+ dateTime->value);
+ return -1;
+ }
+
+ /* expected format: 2010-04-05T12:13:55.316789+02:00 */
+ tmp = strptime(value, "%Y-%m-%dT%H:%M:%S", &tm);
+
+ if (tmp == NULL || *tmp != '.' ||
+ virStrToLong_i(tmp + 1, &tmp, 10, &milliseconds) < 0) {
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
+ _("xsd:dateTime value '%s' has unexpected format"),
+ dateTime->value);
+ return -1;
+ }
+
+ sign = *tmp;
+
+ if ((sign != '+' && sign != '-') ||
+ virStrToLong_i(tmp + 1, &tmp, 10, &tz_hours) < 0 || *tmp != ':' ||
+ virStrToLong_i(tmp + 1, NULL, 10, &tz_minutes) < 0) {
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
+ _("xsd:dateTime value '%s' has unexpected format"),
+ dateTime->value);
+ return -1;
+ }
+
+ tz_offset = tz_hours * 60 * 60 + tz_minutes * 60;
+
+ if (sign == '-') {
+ tz_offset = -tz_offset;
+ }
+
+ /*
+ * xsd:dateTime represents local time relative to the timezone given
+ * as offset. pretend the local time is in UTC and use timegm in order
+ * to avoid interference with the timezone to this computer.
+ * apply timezone correction afterwards, because it's simpler than
+ * handling all the possible over- and underflows when trying to apply
+ * it to the tm struct.
+ */
+ *secondsSinceEpoch = timegm(&tm) - tz_offset;
+
+ return 0;
+}
+
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
@@ -1344,4 +1416,31 @@ esxVI_ManagedObjectReference_Deserialize
return -1;
}
+
+
#include "esx_vi_types.generated.c"
+
+
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * VI Enum: VirtualMachinePowerState (Additions)
+ */
+
+int
+esxVI_VirtualMachinePowerState_ConvertToLibvirt
+ (esxVI_VirtualMachinePowerState powerState)
+{
+ switch (powerState) {
+ case esxVI_VirtualMachinePowerState_PoweredOff:
+ return VIR_DOMAIN_SHUTOFF;
+
+ case esxVI_VirtualMachinePowerState_PoweredOn:
+ return VIR_DOMAIN_RUNNING;
+
+ case esxVI_VirtualMachinePowerState_Suspended:
+ return VIR_DOMAIN_PAUSED;
+
+ default:
+ return VIR_DOMAIN_NOSTATE;
+ }
+}
diff --git a/src/esx/esx_vi_types.h b/src/esx/esx_vi_types.h
index d3c7115..4bedca9 100644
--- a/src/esx/esx_vi_types.h
+++ b/src/esx/esx_vi_types.h
@@ -230,9 +230,12 @@ struct _esxVI_DateTime {
int esxVI_DateTime_Alloc(esxVI_DateTime **dateTime);
void esxVI_DateTime_Free(esxVI_DateTime **dateTime);
int esxVI_DateTime_Validate(esxVI_DateTime *dateTime);
+int esxVI_DateTime_DeepCopy(esxVI_DateTime **dest, esxVI_DateTime *src);
int esxVI_DateTime_Serialize(esxVI_DateTime *dateTime, const char *element,
virBufferPtr output);
int esxVI_DateTime_Deserialize(xmlNodePtr node, esxVI_DateTime **dateTime);
+int esxVI_DateTime_ConvertToCalendarTime(esxVI_DateTime *dateTime,
+ time_t *secondsSinceEpoch);
@@ -295,4 +298,13 @@ int esxVI_ManagedObjectReference_Deserialize
# include "esx_vi_types.generated.h"
+
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * VI Enum: VirtualMachinePowerState (Additions)
+ */
+
+int esxVI_VirtualMachinePowerState_ConvertToLibvirt
+ (esxVI_VirtualMachinePowerState powerState);
+
#endif /* __ESX_VI_TYPES_H__ */
--
1.6.3.3
14 years, 7 months
[libvirt] [PATCH 0/15] Various MinGW/Windows fixes
by Matthias Bolte
This series fixes several MinGW compile problem on Windows.
Most patches are about exported symbols or missing function bodies.
There is also a gnulib issue with MinGW on Windows pending.
Eric and I are working on a patch for it.
Patches:
01/15 gnulib: Add usleep for MinGW builds
02/15 Make sure uid_t and gid_t are available
03/15 Export conditional state driver symbols only when they are defined
04/15 Remove interfaceRegister from libvirt_private.syms
05/15 Fix export of virConnectAuthPtrDefault for MinGW builds
06/15 Generate libvirt.def from libvirt.syms
07/15 virsh: Handle absence of SA_SIGINFO
08/15 Make sure virtTestCaptureProgramOutput has a body on Windows
09/15 util: Make some conditional symbols unconditional
10/15 bootstrap: Remove rsync from buildreq list
11/15 util: Handle lack of (f)chmod and (f)chown on Windows
12/15 bootstrap: Enable copy-mode for MinGW builds
13/15 util: Replace pciWaitForDeviceCleanup with a stub on Windows
14/15 Add HAVE_PTHREAD_H guard for pthread_sigmask
15/15 util: Add stubs for some functions on Windows
Overall diffstat:
bootstrap.conf | 8 ++-
configure.ac | 17 +++++
docs/apibuild.py | 1 +
include/libvirt/libvirt.h.in | 16 +++++-
src/.gitignore | 1 +
src/Makefile.am | 26 ++++++--
src/libvirt_daemon.syms | 10 +++
src/libvirt_private.syms | 9 ---
src/remote/remote_driver.c | 6 ++
src/util/pci.c | 14 ++++
src/util/util.c | 135 ++++++++++++++++++++++++++++++++++++------
src/util/util.h | 4 -
tests/testutils.c | 6 ++
tools/virsh.c | 4 +
14 files changed, 218 insertions(+), 39 deletions(-)
Matthias
14 years, 7 months
[libvirt] Problems accessing ESX using libvirt
by Matthew Booth
I was forwarded the following query relating to v2v:
===
There are no firewalls between the hosts and the ESX firewall is
configured to allow all incoming & outgoing connections.
The "virsh -c 'esx://elabhost011.xxx/' list --all" command
also fails in the same way as the virt-v2v command.
When I run the 'virsh list' command it doesn't prompt for a
username/password as in the example below.
If I run tcpdump on the ESX host, when 'virsh list' is run, I see the
packet arrive from the test box and a reply sent back, only these two
packets are sent between the hosts:
09:51:20.205524 bwyhs0020p.xxx.56436 >
elabhost011.xxx.16514: S 338(0) win 5840 <mss
1460,sackOK,timestamp 1214177495 0,nop,wscale 7> (DF)
09:51:20.205544 elabhost011.xxx.16514 >
bwyhs0020p.xxx.56436: R 0:9 win 0 (DF)
The problem is there is nothing listening on port 16514 on the ESX host,
hence the "Connection refused" message.
Should the connection be using the TSL port as opposed to a 'ESX' port?
===
The user is using libvirt 0.6.3-20.1.el5_4.
Unfortunately I'm not intimately familiar with how the libvirt ESX
driver magic works. Can anybody shed any light?
Thanks,
Matt
--
Matthew Booth, RHCA, RHCSS
Red Hat Engineering, Virtualisation Team
M: +44 (0)7977 267231
GPG ID: D33C3490
GPG FPR: 3733 612D 2D05 5458 8A8A 1600 3441 EA19 D33C 3490
14 years, 7 months
[libvirt] FYI: [PATCH] Fix unterminated B<...> in virsh man page
by Jiri Denemark
FYI, I've just pushed the following trivial fix:
>From 7ea025aed0ff110bd7b5ab2037e04aa3205f2c13 Mon Sep 17 00:00:00 2001
Message-Id: <7ea025aed0ff110bd7b5ab2037e04aa3205f2c13.1270731158.git.jdenemar(a)redhat.com>
From: Jiri Denemark <jdenemar(a)redhat.com>
Date: Thu, 8 Apr 2010 14:44:48 +0200
Subject: [PATCH] Fix unterminated B<...> in virsh man page
Mail-Followup-To: libvir-list(a)redhat.com
---
tools/virsh.pod | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/tools/virsh.pod b/tools/virsh.pod
index 9e9f4e0..1b5c1d6 100644
--- a/tools/virsh.pod
+++ b/tools/virsh.pod
@@ -312,7 +312,7 @@ Convert a domain name (or UUID) to a domain id
Returns basic information about the domain.
-=item B<domjobabort I<domain-id-or-uuid>
+=item B<domjobabort> I<domain-id-or-uuid>
Abort the currently running domain job.
--
1.7.0.4
14 years, 7 months
[libvirt] [PATCH] Fix Win32 portability problems
by Daniel P. Berrange
The network filter / snapshot / hooks code introduced some
non-portable pices that broke the win32 build
* configure.ac: Check for net/ethernet.h required by nwfile config
parsing code
* src/conf/nwfilter_conf.c: Define ethernet protocol constants
if net/ethernet.h is missing
* src/util/hooks.c: Disable hooks build on Win32 since it lacks
fork/exec/pipe
* src/util/threads-win32.c: Fix unchecked return value
* tools/virsh.c: Disable SIGPIPE on Win32 since it doesn't exist.
Fix non-portable strftime() formats
---
configure.ac | 2 +-
src/conf/nwfilter_conf.c | 20 ++++++++++++++++++++
src/util/hooks.c | 16 ++++++++++++++++
src/util/threads-win32.c | 2 +-
tools/virsh.c | 7 ++++++-
5 files changed, 44 insertions(+), 3 deletions(-)
diff --git a/configure.ac b/configure.ac
index e13961e..9a133e4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -111,7 +111,7 @@ dnl Availability of various not common threadsafe functions
AC_CHECK_FUNCS([strerror_r strtok_r getmntent_r getgrnam_r getpwuid_r])
dnl Availability of various common headers (non-fatal if missing).
-AC_CHECK_HEADERS([pwd.h paths.h regex.h sys/syslimits.h sys/utsname.h sys/wait.h winsock2.h sched.h termios.h sys/poll.h syslog.h mntent.h])
+AC_CHECK_HEADERS([pwd.h paths.h regex.h sys/syslimits.h sys/utsname.h sys/wait.h winsock2.h sched.h termios.h sys/poll.h syslog.h mntent.h net/ethernet.h])
dnl Where are the XDR functions?
dnl If portablexdr is installed, prefer that.
diff --git a/src/conf/nwfilter_conf.c b/src/conf/nwfilter_conf.c
index 16c1a25..0fe51e4 100644
--- a/src/conf/nwfilter_conf.c
+++ b/src/conf/nwfilter_conf.c
@@ -26,9 +26,13 @@
#include <config.h>
+#include <sys/types.h>
+#include <sys/stat.h>
#include <fcntl.h>
#include <dirent.h>
+#if HAVE_NET_ETHERNET_H
#include <net/ethernet.h>
+#endif
#include "internal.h"
@@ -41,6 +45,22 @@
#include "domain_conf.h"
+/* XXX
+ * The config parser/struts should not be using platform specific
+ * constants. Win32 lacks these constants, breaking the parser,
+ * so temporarily define them until this can be re-written to use
+ * locally defined enums for all consants
+ */
+#ifndef ETHERTYPE_IP
+#define ETHERTYPE_IP 0x0800
+#endif
+#ifndef ETHERTYPE_ARP
+#define ETHERTYPE_ARP 0x0806
+#endif
+#ifndef ETHERTYPE_IPV6
+#define ETHERTYPE_IPV6 0x86dd
+#endif
+
#define VIR_FROM_THIS VIR_FROM_NWFILTER
diff --git a/src/util/hooks.c b/src/util/hooks.c
index 755679d..bcab4eb 100644
--- a/src/util/hooks.c
+++ b/src/util/hooks.c
@@ -24,7 +24,9 @@
#include <config.h>
#include <sys/types.h>
+#if HAVE_SYS_WAIT_H
#include <sys/wait.h>
+#endif
#include <sys/stat.h>
#include <unistd.h>
#include <stdlib.h>
@@ -188,6 +190,19 @@ virHookPresent(int driver) {
* Returns: 0 if the execution succeeded, 1 if the script was not found or
* invalid parameters, and -1 if script returned an error
*/
+#ifdef WIN32
+int
+virHookCall(int driver ATTRIBUTE_UNUSED,
+ const char *id ATTRIBUTE_UNUSED,
+ int op ATTRIBUTE_UNUSED,
+ int sub_op ATTRIBUTE_UNUSED,
+ const char *extra ATTRIBUTE_UNUSED,
+ const char *input ATTRIBUTE_UNUSED) {
+ virReportSystemError(ENOSYS, "%s",
+ _("spawning hooks not supported on this platform"));
+ return -1;
+}
+#else
int
virHookCall(int driver, const char *id, int op, int sub_op, const char *extra,
const char *input) {
@@ -447,3 +462,4 @@ no_memory:
#undef ADD_ENV_LIT
#undef ADD_ENV_SPACE
}
+#endif
diff --git a/src/util/threads-win32.c b/src/util/threads-win32.c
index b1d1571..a30bccf 100644
--- a/src/util/threads-win32.c
+++ b/src/util/threads-win32.c
@@ -69,7 +69,7 @@ void virThreadOnExit(void)
int virMutexInit(virMutexPtr m)
{
- virMutexInitRecursive(m);
+ return virMutexInitRecursive(m);
}
int virMutexInitRecursive(virMutexPtr m)
diff --git a/tools/virsh.c b/tools/virsh.c
index aaae7ca..8017beb 100644
--- a/tools/virsh.c
+++ b/tools/virsh.c
@@ -414,6 +414,7 @@ out:
*/
static int disconnected = 0; /* we may have been disconnected */
+#ifdef SIGPIPE
/*
* vshCatchDisconnect:
*
@@ -442,6 +443,10 @@ vshSetupSignals(void) {
sigaction(SIGPIPE, &sig_action, NULL);
}
+#else
+static void
+vshSetupSignals(void) {}
+#endif
/*
* vshReconnect:
@@ -8425,7 +8430,7 @@ cmdSnapshotList(vshControl *ctl, const vshCmd *cmd)
&creation) < 0)
continue;
localtime_r(&creation, &time_info);
- strftime(timestr, sizeof(timestr), "%F %T %z", &time_info);
+ strftime(timestr, sizeof(timestr), "%Y-%m-%d %H:%M:%S %z", &time_info);
vshPrint(ctl, " %-20s %-25s %s\n", names[i], timestr, state);
}
--
1.6.6.1
14 years, 7 months
[libvirt] [PATCH v2] nwfilter: fix for directionality of ICMP traffic
by Stefan Berger
Changes from V1 to V2 of this patch
- I had reversed the logic thinking that icmp type 0 is a echo
request,but it's reply -- needed to reverse the logic
- Found that ebtables takes the --ip-tos argument only as a hex number
This patch enables the skipping of some of the ICMP traffic rules on the
iptables level under certain circumstances so that the following filter
properly enables unidirectional pings:
<filter name='testcase'>
<uuid>d6b1a2af-def6-2898-9f8d-4a74e3c39558</uuid>
<!-- allow incoming ICMP Echo Request -->
<rule action='accept' direction='in' priority='500'>
<icmp type='8'/>
</rule>
<!-- allow outgoing ICMP Echo Reply -->
<rule action='accept' direction='out' priority='500'>
<icmp type='0'/>
</rule>
<!-- drop all other ICMP traffic -->
<rule action='drop' direction='inout' priority='600'>
<icmp/>
</rule>
</filter>
Signed-off-by: Stefan Berger <stefanb(a)us.ibm.com>
---
src/nwfilter/nwfilter_ebiptables_driver.c | 108
+++++++++++++++++-------------
1 file changed, 64 insertions(+), 44 deletions(-)
Index: libvirt-acl/src/nwfilter/nwfilter_ebiptables_driver.c
===================================================================
--- libvirt-acl.orig/src/nwfilter/nwfilter_ebiptables_driver.c
+++ libvirt-acl/src/nwfilter/nwfilter_ebiptables_driver.c
@@ -1022,6 +1022,12 @@ err_exit:
* @ifname : The name of the interface to apply the rule to
* @vars : A map containing the variables to resolve
* @res : The data structure to store the result(s) into
+ * @match : optional string for state match
+ * @accept_target : where to jump to on accepted traffic, i.e.,
"RETURN"
+ * "ACCEPT"
+ * @isIPv6 : Whether this is an IPv6 rule
+ * @maySkipICMP : whether this rule may under certain circumstances
skip
+ * the ICMP rule from being created
*
* Convert a single rule into its representation for later
instantiation
*
@@ -1039,7 +1045,8 @@ _iptablesCreateRuleInstance(int directio
virNWFilterRuleInstPtr res,
const char *match,
const char *accept_target,
- bool isIPv6)
+ bool isIPv6,
+ bool maySkipICMP)
{
char chain[MAX_CHAINNAME_LENGTH];
char number[20];
@@ -1265,6 +1272,10 @@ _iptablesCreateRuleInstance(int directio
if (HAS_ENTRY_ITEM(&rule->p.icmpHdrFilter.dataICMPType)) {
const char *parm;
+
+ if (maySkipICMP)
+ goto exit_no_error;
+
if (rule->prtclType == VIR_NWFILTER_RULE_PROTOCOL_ICMP)
parm = "--icmp-type";
else
@@ -1386,6 +1397,10 @@ err_exit:
return -1;
+exit_no_error:
+ virBufferFreeAndReset(&buf);
+
+ return 0;
}
@@ -1401,15 +1416,19 @@ iptablesCreateRuleInstance(virNWFilterDe
int directionIn = 0;
char chainPrefix[2];
int needState = 1;
+ bool maySkipICMP, inout = false;
if ((rule->tt == VIR_NWFILTER_RULE_DIRECTION_IN) ||
(rule->tt == VIR_NWFILTER_RULE_DIRECTION_INOUT)) {
directionIn = 1;
needState = 0;
+ inout = (rule->tt == VIR_NWFILTER_RULE_DIRECTION_INOUT);
}
chainPrefix[0] = 'F';
+ maySkipICMP = directionIn || inout;
+
chainPrefix[1] = CHAINPREFIX_HOST_IN_TEMP;
rc = _iptablesCreateRuleInstance(directionIn,
chainPrefix,
@@ -1421,10 +1440,14 @@ iptablesCreateRuleInstance(virNWFilterDe
needState ? MATCH_STATE_OUT
: NULL,
"RETURN",
- isIPv6);
+ isIPv6,
+ maySkipICMP);
if (rc)
return rc;
+
+ maySkipICMP = !directionIn || inout;
+
chainPrefix[1] = CHAINPREFIX_HOST_OUT_TEMP;
rc = _iptablesCreateRuleInstance(!directionIn,
chainPrefix,
@@ -1436,10 +1459,13 @@ iptablesCreateRuleInstance(virNWFilterDe
needState ? MATCH_STATE_IN
: NULL,
"ACCEPT",
- isIPv6);
+ isIPv6,
+ maySkipICMP);
if (rc)
return rc;
+ maySkipICMP = directionIn;
+
chainPrefix[0] = 'H';
chainPrefix[1] = CHAINPREFIX_HOST_IN_TEMP;
rc = _iptablesCreateRuleInstance(directionIn,
@@ -1451,9 +1477,8 @@ iptablesCreateRuleInstance(virNWFilterDe
res,
NULL,
"ACCEPT",
- isIPv6);
- if (rc)
- return rc;
+ isIPv6,
+ maySkipICMP);
return rc;
}
@@ -1750,9 +1775,9 @@ ebtablesCreateRuleInstance(char chainPre
}
if (HAS_ENTRY_ITEM(&rule->p.ipHdrFilter.ipHdr.dataDSCP)) {
- if (printDataType(vars,
- number, sizeof(number),
- &rule->p.ipHdrFilter.ipHdr.dataDSCP))
+ if (printDataTypeAsHex(vars,
+ number, sizeof(number),
+
&rule->p.ipHdrFilter.ipHdr.dataDSCP))
goto err_exit;
virBufferVSprintf(&buf,
14 years, 7 months
[libvirt] [PATCH Repost] esx: Allow 'lsisas1068' as SCSI controller type
by Matthias Bolte
Extend tests to cover all SCSI controller types and document the
new type.
The lsisas1068 SCSI controller type was added in ESX 4.0. The VMX
parser reports an error when this controller type is present. This
makes virsh dumpxml fail for every domain that uses this controller
type.
This patch fixes this and adds lsisas1068 to the list of accepted
SCSI controller types.
Reported by Jonathan Kelley.
---
This is a repost of this patch [1].
DanPB pointed out that the ESX driver is currently abusing the <driver>
element to expose the SCSI controller type.
Now we have the <controller> element to explicitly model stuff like
SCSI controllers in the domain XML config. The ESX driver doesn't
support this yet. Also there is currently no way to express the SCSI
controller type in the <controller> element. Something like the model
attribute for NICs need to be added here too.
So I'd like to push this patch now in order to have the immediate
problem of failing virsh dumpxml fixed in libvirt 0.8.0. I already got
asked offlist when this problem will be fixed.
[1] https://www.redhat.com/archives/libvir-list/2010-March/msg00548.html
Matthias
docs/drvesx.html.in | 4 +++
src/esx/esx_vmx.c | 14 +++++++-----
tests/vmx2xmldata/vmx2xml-scsi-buslogic.vmx | 7 ------
tests/vmx2xmldata/vmx2xml-scsi-buslogic.xml | 20 ------------------
tests/vmx2xmldata/vmx2xml-scsi-driver.vmx | 17 +++++++++++++++
tests/vmx2xmldata/vmx2xml-scsi-driver.xml | 30 +++++++++++++++++++++++++++
tests/vmx2xmltest.c | 2 +-
tests/xml2vmxdata/xml2vmx-scsi-buslogic.vmx | 12 ----------
tests/xml2vmxdata/xml2vmx-scsi-buslogic.xml | 15 -------------
tests/xml2vmxdata/xml2vmx-scsi-driver.vmx | 22 +++++++++++++++++++
tests/xml2vmxdata/xml2vmx-scsi-driver.xml | 25 ++++++++++++++++++++++
tests/xml2vmxtest.c | 2 +-
12 files changed, 108 insertions(+), 62 deletions(-)
delete mode 100644 tests/vmx2xmldata/vmx2xml-scsi-buslogic.vmx
delete mode 100644 tests/vmx2xmldata/vmx2xml-scsi-buslogic.xml
create mode 100644 tests/vmx2xmldata/vmx2xml-scsi-driver.vmx
create mode 100644 tests/vmx2xmldata/vmx2xml-scsi-driver.xml
delete mode 100644 tests/xml2vmxdata/xml2vmx-scsi-buslogic.vmx
delete mode 100644 tests/xml2vmxdata/xml2vmx-scsi-buslogic.xml
create mode 100644 tests/xml2vmxdata/xml2vmx-scsi-driver.vmx
create mode 100644 tests/xml2vmxdata/xml2vmx-scsi-driver.xml
diff --git a/docs/drvesx.html.in b/docs/drvesx.html.in
index d5c192d..422a7f0 100644
--- a/docs/drvesx.html.in
+++ b/docs/drvesx.html.in
@@ -282,6 +282,10 @@ ethernet0.checkMACAddress = "false"
<dd>
LSI Logic SCSI controller for recent guests.
</dd>
+ <dt><code>lsisas1068</code></dt>
+ <dd>
+ LSI Logic SAS 1068 controller.
+ </dd>
</dl>
<p>
Here a domain XML snippet:
diff --git a/src/esx/esx_vmx.c b/src/esx/esx_vmx.c
index d242fc6..647e720 100644
--- a/src/esx/esx_vmx.c
+++ b/src/esx/esx_vmx.c
@@ -552,10 +552,11 @@ esxVMX_GatherSCSIControllers(virDomainDefPtr def, char *virtualDev[4],
if (disk->driverName != NULL &&
STRCASENEQ(disk->driverName, "buslogic") &&
- STRCASENEQ(disk->driverName, "lsilogic")) {
+ STRCASENEQ(disk->driverName, "lsilogic") &&
+ STRCASENEQ(disk->driverName, "lsisas1068")) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
_("Expecting domain XML entry 'devices/disk/target' to "
- "be 'buslogic' or 'lsilogic' but found '%s'"),
+ "be 'buslogic' or 'lsilogic' or 'lsisas1068' but found '%s'"),
disk->driverName);
return -1;
}
@@ -1266,10 +1267,11 @@ esxVMX_ParseSCSIController(virConfPtr conf, int controller, int *present,
if (*virtualDev != NULL &&
STRCASENEQ(*virtualDev, "buslogic") &&
- STRCASENEQ(*virtualDev, "lsilogic")) {
+ STRCASENEQ(*virtualDev, "lsilogic") &&
+ STRCASENEQ(*virtualDev, "lsisas1068")) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("Expecting VMX entry '%s' to be 'buslogic' or 'lsilogic' "
- "but found '%s'"), virtualDev_name, *virtualDev);
+ _("Expecting VMX entry '%s' to be 'buslogic' or 'lsilogic' or "
+ "'lsisas1068' but found '%s'"), virtualDev_name, *virtualDev);
goto failure;
}
@@ -1309,7 +1311,7 @@ esxVMX_ParseDisk(esxVI_Context *ctx, virConfPtr conf, int device, int bus,
* bus = VIR_DOMAIN_DISK_BUS_SCSI
* controller = [0..3]
* id = [0..6,8..15]
- * virtualDev = {'buslogic', 'lsilogic'}
+ * virtualDev = {'buslogic', 'lsilogic', 'lsisas1068'}
*
* device = {VIR_DOMAIN_DISK_DEVICE_DISK, VIR_DOMAIN_DISK_DEVICE_CDROM}
* bus = VIR_DOMAIN_DISK_BUS_IDE
diff --git a/tests/vmx2xmldata/vmx2xml-scsi-buslogic.vmx b/tests/vmx2xmldata/vmx2xml-scsi-buslogic.vmx
deleted file mode 100644
index 1725051..0000000
--- a/tests/vmx2xmldata/vmx2xml-scsi-buslogic.vmx
+++ /dev/null
@@ -1,7 +0,0 @@
-config.version = "8"
-virtualHW.version = "4"
-scsi0.present = "true"
-scsi0.virtualDev = "buslogic"
-scsi0:0.present = "true"
-scsi0:0.deviceType = "scsi-hardDisk"
-scsi0:0.fileName = "harddisk.vmdk"
diff --git a/tests/vmx2xmldata/vmx2xml-scsi-buslogic.xml b/tests/vmx2xmldata/vmx2xml-scsi-buslogic.xml
deleted file mode 100644
index 2ffb866..0000000
--- a/tests/vmx2xmldata/vmx2xml-scsi-buslogic.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-<domain type='vmware'>
- <uuid>00000000-0000-0000-0000-000000000000</uuid>
- <memory>32768</memory>
- <currentMemory>32768</currentMemory>
- <vcpu>1</vcpu>
- <os>
- <type arch='i686'>hvm</type>
- </os>
- <clock offset='utc'/>
- <on_poweroff>destroy</on_poweroff>
- <on_reboot>restart</on_reboot>
- <on_crash>destroy</on_crash>
- <devices>
- <disk type='file' device='disk'>
- <driver name='buslogic'/>
- <source file='[datastore] directory/harddisk.vmdk'/>
- <target dev='sda' bus='scsi'/>
- </disk>
- </devices>
-</domain>
diff --git a/tests/vmx2xmldata/vmx2xml-scsi-driver.vmx b/tests/vmx2xmldata/vmx2xml-scsi-driver.vmx
new file mode 100644
index 0000000..cb055f6
--- /dev/null
+++ b/tests/vmx2xmldata/vmx2xml-scsi-driver.vmx
@@ -0,0 +1,17 @@
+config.version = "8"
+virtualHW.version = "4"
+scsi0.present = "true"
+scsi0.virtualDev = "buslogic"
+scsi1.present = "true"
+scsi1.virtualDev = "lsilogic"
+scsi2.present = "true"
+scsi2.virtualDev = "lsisas1068"
+scsi0:0.present = "true"
+scsi0:0.deviceType = "scsi-hardDisk"
+scsi0:0.fileName = "harddisk1.vmdk"
+scsi1:0.present = "true"
+scsi1:0.deviceType = "scsi-hardDisk"
+scsi1:0.fileName = "harddisk2.vmdk"
+scsi2:0.present = "true"
+scsi2:0.deviceType = "scsi-hardDisk"
+scsi2:0.fileName = "harddisk3.vmdk"
diff --git a/tests/vmx2xmldata/vmx2xml-scsi-driver.xml b/tests/vmx2xmldata/vmx2xml-scsi-driver.xml
new file mode 100644
index 0000000..1fa9ac4
--- /dev/null
+++ b/tests/vmx2xmldata/vmx2xml-scsi-driver.xml
@@ -0,0 +1,30 @@
+<domain type='vmware'>
+ <uuid>00000000-0000-0000-0000-000000000000</uuid>
+ <memory>32768</memory>
+ <currentMemory>32768</currentMemory>
+ <vcpu>1</vcpu>
+ <os>
+ <type arch='i686'>hvm</type>
+ </os>
+ <clock offset='utc'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>destroy</on_crash>
+ <devices>
+ <disk type='file' device='disk'>
+ <driver name='buslogic'/>
+ <source file='[datastore] directory/harddisk1.vmdk'/>
+ <target dev='sda' bus='scsi'/>
+ </disk>
+ <disk type='file' device='disk'>
+ <driver name='lsilogic'/>
+ <source file='[datastore] directory/harddisk2.vmdk'/>
+ <target dev='sdp' bus='scsi'/>
+ </disk>
+ <disk type='file' device='disk'>
+ <driver name='lsisas1068'/>
+ <source file='[datastore] directory/harddisk3.vmdk'/>
+ <target dev='sdae' bus='scsi'/>
+ </disk>
+ </devices>
+</domain>
diff --git a/tests/vmx2xmltest.c b/tests/vmx2xmltest.c
index b036f5b..f3b3b5e 100644
--- a/tests/vmx2xmltest.c
+++ b/tests/vmx2xmltest.c
@@ -130,7 +130,7 @@ mymain(int argc, char **argv)
DO_TEST("graphics-vnc", "graphics-vnc", esxVI_APIVersion_25);
- DO_TEST("scsi-buslogic", "scsi-buslogic", esxVI_APIVersion_25);
+ DO_TEST("scsi-driver", "scsi-driver", esxVI_APIVersion_25);
DO_TEST("scsi-writethrough", "scsi-writethrough", esxVI_APIVersion_25);
DO_TEST("harddisk-scsi-file", "harddisk-scsi-file", esxVI_APIVersion_25);
diff --git a/tests/xml2vmxdata/xml2vmx-scsi-buslogic.vmx b/tests/xml2vmxdata/xml2vmx-scsi-buslogic.vmx
deleted file mode 100644
index 2f98da3..0000000
--- a/tests/xml2vmxdata/xml2vmx-scsi-buslogic.vmx
+++ /dev/null
@@ -1,12 +0,0 @@
-config.version = "8"
-virtualHW.version = "4"
-guestOS = "other"
-uuid.bios = "56 4d 9b ef ac d9 b4 e0-c8 f0 ae a8 b9 10 35 15"
-displayName = "scsi-buslogic"
-memsize = "4"
-numvcpus = "1"
-scsi0.present = "true"
-scsi0.virtualDev = "buslogic"
-scsi0:0.present = "true"
-scsi0:0.deviceType = "scsi-hardDisk"
-scsi0:0.fileName = "/vmfs/volumes/datastore/directory/harddisk.vmdk"
diff --git a/tests/xml2vmxdata/xml2vmx-scsi-buslogic.xml b/tests/xml2vmxdata/xml2vmx-scsi-buslogic.xml
deleted file mode 100644
index 5d52c54..0000000
--- a/tests/xml2vmxdata/xml2vmx-scsi-buslogic.xml
+++ /dev/null
@@ -1,15 +0,0 @@
-<domain type='vmware'>
- <name>scsi-buslogic</name>
- <uuid>564d9bef-acd9-b4e0-c8f0-aea8b9103515</uuid>
- <memory>4096</memory>
- <os>
- <type>hvm</type>
- </os>
- <devices>
- <disk type='file' device='disk'>
- <driver name='buslogic'/>
- <source file='[datastore] directory/harddisk.vmdk'/>
- <target dev='sda' bus='scsi'/>
- </disk>
- </devices>
-</domain>
diff --git a/tests/xml2vmxdata/xml2vmx-scsi-driver.vmx b/tests/xml2vmxdata/xml2vmx-scsi-driver.vmx
new file mode 100644
index 0000000..7cceca0
--- /dev/null
+++ b/tests/xml2vmxdata/xml2vmx-scsi-driver.vmx
@@ -0,0 +1,22 @@
+config.version = "8"
+virtualHW.version = "4"
+guestOS = "other"
+uuid.bios = "56 4d 9b ef ac d9 b4 e0-c8 f0 ae a8 b9 10 35 15"
+displayName = "scsi-buslogic"
+memsize = "4"
+numvcpus = "1"
+scsi0.present = "true"
+scsi0.virtualDev = "buslogic"
+scsi1.present = "true"
+scsi1.virtualDev = "lsilogic"
+scsi2.present = "true"
+scsi2.virtualDev = "lsisas1068"
+scsi0:0.present = "true"
+scsi0:0.deviceType = "scsi-hardDisk"
+scsi0:0.fileName = "/vmfs/volumes/datastore/directory/harddisk1.vmdk"
+scsi1:0.present = "true"
+scsi1:0.deviceType = "scsi-hardDisk"
+scsi1:0.fileName = "/vmfs/volumes/datastore/directory/harddisk2.vmdk"
+scsi2:0.present = "true"
+scsi2:0.deviceType = "scsi-hardDisk"
+scsi2:0.fileName = "/vmfs/volumes/datastore/directory/harddisk3.vmdk"
diff --git a/tests/xml2vmxdata/xml2vmx-scsi-driver.xml b/tests/xml2vmxdata/xml2vmx-scsi-driver.xml
new file mode 100644
index 0000000..797a26e
--- /dev/null
+++ b/tests/xml2vmxdata/xml2vmx-scsi-driver.xml
@@ -0,0 +1,25 @@
+<domain type='vmware'>
+ <name>scsi-buslogic</name>
+ <uuid>564d9bef-acd9-b4e0-c8f0-aea8b9103515</uuid>
+ <memory>4096</memory>
+ <os>
+ <type>hvm</type>
+ </os>
+ <devices>
+ <disk type='file' device='disk'>
+ <driver name='buslogic'/>
+ <source file='[datastore] directory/harddisk1.vmdk'/>
+ <target dev='sda' bus='scsi'/>
+ </disk>
+ <disk type='file' device='disk'>
+ <driver name='lsilogic'/>
+ <source file='[datastore] directory/harddisk2.vmdk'/>
+ <target dev='sdp' bus='scsi'/>
+ </disk>
+ <disk type='file' device='disk'>
+ <driver name='lsisas1068'/>
+ <source file='[datastore] directory/harddisk3.vmdk'/>
+ <target dev='sdae' bus='scsi'/>
+ </disk>
+ </devices>
+</domain>
diff --git a/tests/xml2vmxtest.c b/tests/xml2vmxtest.c
index b8b9d6f..f9c4730 100644
--- a/tests/xml2vmxtest.c
+++ b/tests/xml2vmxtest.c
@@ -175,7 +175,7 @@ mymain(int argc, char **argv)
DO_TEST("graphics-vnc", "graphics-vnc", esxVI_APIVersion_25);
- DO_TEST("scsi-buslogic", "scsi-buslogic", esxVI_APIVersion_25);
+ DO_TEST("scsi-driver", "scsi-driver", esxVI_APIVersion_25);
DO_TEST("scsi-writethrough", "scsi-writethrough", esxVI_APIVersion_25);
DO_TEST("harddisk-scsi-file", "harddisk-scsi-file", esxVI_APIVersion_25);
--
1.6.3.3
14 years, 7 months
[libvirt] [PATCH] esx: Report an error for invalid arguments in esxList(Defined)Domains
by Matthias Bolte
---
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 888ac10..eb06555 100644
--- a/src/esx/esx_driver.c
+++ b/src/esx/esx_driver.c
@@ -964,7 +964,8 @@ esxListDomains(virConnectPtr conn, int *ids, int maxids)
int count = 0;
if (ids == NULL || maxids < 0) {
- goto failure;
+ ESX_ERROR(VIR_ERR_INVALID_ARG, "%s", _("Invalid arguemnt"));
+ return -1;
}
if (maxids == 0) {
@@ -2255,7 +2256,8 @@ esxListDefinedDomains(virConnectPtr conn, char **const names, int maxnames)
int i;
if (names == NULL || maxnames < 0) {
- goto failure;
+ ESX_ERROR(VIR_ERR_INVALID_ARG, "%s", _("Invalid arguemnt"));
+ return -1;
}
if (maxnames == 0) {
--
1.6.3.3
14 years, 7 months
[libvirt] [PATCH] Avoid searching for windres when not building for cygwin or mingw.
by Diego Elio Pettenò
Just checking for a windres tool might hit even on Linux systems when
building for Linux (e.g.: when using Gentoo and having built binutils with
multitarget support), and will then fail to link properly at the end of the
build.
Check the host string before deciding whether to look for windres or not.
---
configure.ac | 9 +++++++--
1 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/configure.ac b/configure.ac
index 29c6396..e6122b9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1676,8 +1676,13 @@ AC_SUBST([CYGWIN_EXTRA_PYTHON_LIBADD])
AC_SUBST([MINGW_EXTRA_LDFLAGS])
dnl Look for windres to build a Windows icon resource.
-AC_CHECK_TOOL([WINDRES], [windres], [no])
-AM_CONDITIONAL([WITH_WIN_ICON], [test "$WINDRES" != "no"])
+case "$host" in
+ *cygwin* | *mingw* )
+ AC_CHECK_TOOL([WINDRES], [windres], [])
+ ;;
+esac
+
+AM_CONDITIONAL([WITH_WIN_ICON], [test "$WINDRES" != ""])
--
1.6.6.1
14 years, 7 months