int \
esxVI_##_type##_Alloc(esxVI_##_type **ptrptr) \
{ \
- if (!ptrptr || *ptrptr) { \
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); \
- return -1; \
- } \
+ ESX_VI_CHECK_ARG_LIST(ptrptr); \
\
if (VIR_ALLOC(*ptrptr) < 0) \
return -1; \
virBuffer buffer = VIR_BUFFER_INITIALIZER;
int responseCode = 0;
- if (!content || *content) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
- return -1;
- }
+ ESX_VI_CHECK_ARG_LIST(content);
if (length && *length > 0) {
/*
esxVI_List *dest = NULL;
esxVI_List *src = NULL;
- if (!destList || *destList) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
- return -1;
- }
+ ESX_VI_CHECK_ARG_LIST(destList);
for (src = srcList; src; src = src->_next) {
if (deepCopyFunc(&dest, src) < 0 ||
bool propertySpec_isAppended = false;
esxVI_PropertyFilterSpec *propertyFilterSpec = NULL;
- if (!objectContentList || *objectContentList) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
- return -1;
- }
+ ESX_VI_CHECK_ARG_LIST(objectContentList);
if (esxVI_ObjectSpec_Alloc(&objectSpec) < 0)
return -1;
{
esxVI_DynamicProperty *dynamicProperty;
- if (!questionInfo || *questionInfo) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
- return -1;
- }
+ ESX_VI_CHECK_ARG_LIST(questionInfo);
for (dynamicProperty = virtualMachine->propSet; dynamicProperty;
dynamicProperty = dynamicProperty->_next) {
{
esxVI_DynamicProperty *dynamicProperty;
- if (!value || *value) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
- return -1;
- }
+ ESX_VI_CHECK_ARG_LIST(value);
for (dynamicProperty = objectContent->propSet; dynamicProperty;
dynamicProperty = dynamicProperty->_next) {
{
esxVI_DynamicProperty *dynamicProperty;
- if (!value || *value) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
- return -1;
- }
+ ESX_VI_CHECK_ARG_LIST(value);
for (dynamicProperty = objectContent->propSet; dynamicProperty;
dynamicProperty = dynamicProperty->_next) {
{
esxVI_DynamicProperty *dynamicProperty;
- if (!value || *value) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
- return -1;
- }
+ ESX_VI_CHECK_ARG_LIST(value);
for (dynamicProperty = objectContent->propSet; dynamicProperty;
dynamicProperty = dynamicProperty->_next) {
{
esxVI_DynamicProperty *dynamicProperty;
- if (!value || *value) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
- return -1;
- }
+ ESX_VI_CHECK_ARG_LIST(value);
for (dynamicProperty = objectContent->propSet; dynamicProperty;
dynamicProperty = dynamicProperty->_next) {
{
esxVI_VirtualMachineSnapshotTree *candidate;
- if (!snapshotTree || *snapshotTree) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
- return -1;
- }
+ ESX_VI_CHECK_ARG_LIST(snapshotTree);
for (candidate = snapshotTreeList; candidate;
candidate = candidate->_next) {
esxVI_ManagedObjectReference *managedObjectReference = NULL;
char uuid_string[VIR_UUID_STRING_BUFLEN] = "";
- if (!virtualMachine || *virtualMachine) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
- return -1;
- }
+ ESX_VI_CHECK_ARG_LIST(virtualMachine);
virUUIDFormat(uuid, uuid_string);
esxVI_ObjectContent *candidate = NULL;
char *name_candidate = NULL;
- if (!virtualMachine || *virtualMachine) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
- return -1;
- }
+ ESX_VI_CHECK_ARG_LIST(virtualMachine);
if (esxVI_String_DeepCopyList(&completePropertyNameList,
propertyNameList) < 0 ||
esxVI_ObjectContent *candidate = NULL;
char *name_candidate;
- if (!datastore || *datastore) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
- return -1;
- }
+ ESX_VI_CHECK_ARG_LIST(datastore);
/* Get all datastores */
if (esxVI_String_DeepCopyList(&completePropertyNameList,
esxVI_DatastoreHostMount *datastoreHostMountList = NULL;
esxVI_DatastoreHostMount *datastoreHostMount = NULL;
- if (!datastore || *datastore) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
- return -1;
- }
+ ESX_VI_CHECK_ARG_LIST(datastore);
/* Get all datastores */
if (esxVI_String_DeepCopyList(&completePropertyNameList,
esxVI_DatastoreHostMount *hostMountList = NULL;
esxVI_DatastoreHostMount *candidate = NULL;
- if (!hostMount || *hostMount) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
- return -1;
- }
+ ESX_VI_CHECK_ARG_LIST(hostMount);
if (esxVI_String_AppendValueToList(&propertyNameList, "host") < 0 ||
esxVI_LookupObjectContentByType(ctx, datastore, "Datastore",
esxVI_ObjectContent *objectContent = NULL;
esxVI_DynamicProperty *dynamicProperty = NULL;
- if (!taskInfo || *taskInfo) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
- return -1;
- }
+ ESX_VI_CHECK_ARG_LIST(taskInfo);
if (esxVI_String_AppendValueToList(&propertyNameList, "info") < 0 ||
esxVI_LookupObjectContentByType(ctx, task, "Task", propertyNameList,
esxVI_DynamicProperty *dynamicProperty = NULL;
esxVI_TaskInfo *taskInfo = NULL;
- if (!pendingTaskInfoList || *pendingTaskInfoList) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
- return -1;
- }
+ ESX_VI_CHECK_ARG_LIST(pendingTaskInfoList);
/* Get list of recent tasks */
for (dynamicProperty = virtualMachine->propSet; dynamicProperty;
esxVI_ObjectContent *virtualMachine = NULL;
esxVI_DynamicProperty *dynamicProperty = NULL;
- if (!rootSnapshotTreeList || *rootSnapshotTreeList) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
- return -1;
- }
+ ESX_VI_CHECK_ARG_LIST(rootSnapshotTreeList);
if (esxVI_String_AppendValueToList(&propertyNameList,
"snapshot.rootSnapshotList") < 0 ||
esxVI_VirtualMachineSnapshotTree *rootSnapshotTreeList = NULL;
esxVI_VirtualMachineSnapshotTree *snapshotTree = NULL;
- if (!currentSnapshotTree || *currentSnapshotTree) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
- return -1;
- }
+ ESX_VI_CHECK_ARG_LIST(currentSnapshotTree);
if (esxVI_String_AppendValueListToList(&propertyNameList,
"snapshot.currentSnapshot\0"
esxVI_TaskInfo *taskInfo = NULL;
esxVI_HostDatastoreBrowserSearchResults *searchResults = NULL;
- if (!fileInfo || *fileInfo) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
- return -1;
- }
+ ESX_VI_CHECK_ARG_LIST(fileInfo);
if (esxUtil_ParseDatastorePath(datastorePath, &datastoreName,
&directoryName, &directoryAndFileName) < 0) {
char *taskInfoErrorMessage = NULL;
esxVI_TaskInfo *taskInfo = NULL;
- if (!searchResultsList || *searchResultsList) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
- return -1;
- }
+ ESX_VI_CHECK_ARG_LIST(searchResultsList);
/* Lookup Datastore and HostDatastoreBrowser */
if (esxVI_String_AppendValueToList(&propertyNameList, "browser") < 0 ||
esxVI_FileInfo *fileInfo = NULL;
char *uuid_string = NULL;
- if (!key || *key) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
- return -1;
- }
+ ESX_VI_CHECK_ARG_LIST(key);
if (ctx->hasQueryVirtualDiskUuid) {
if (esxVI_LookupFileInfoByDatastorePath
esxVI_ObjectContent *hostAutoStartManager = NULL;
esxVI_DynamicProperty *dynamicProperty = NULL;
- if (!defaults || *defaults) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
- return -1;
- }
+ ESX_VI_CHECK_ARG_LIST(defaults);
/*
* Lookup HostAutoStartManagerConfig from the HostAutoStartManager because
esxVI_ObjectContent *hostAutoStartManager = NULL;
esxVI_DynamicProperty *dynamicProperty = NULL;
- if (!powerInfoList || *powerInfoList) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
- return -1;
- }
+ ESX_VI_CHECK_ARG_LIST(powerInfoList);
/*
* Lookup HostAutoStartManagerConfig from the HostAutoStartManager because
esxVI_ObjectContent *hostSystem = NULL;
esxVI_DynamicProperty *dynamicProperty = NULL;
- if (!physicalNicList || *physicalNicList) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
- return -1;
- }
+ ESX_VI_CHECK_ARG_LIST(physicalNicList);
if (esxVI_String_AppendValueToList(&propertyNameList,
"config.network.pnic") < 0 ||
esxVI_PhysicalNic *physicalNicList = NULL;
esxVI_PhysicalNic *candidate = NULL;
- if (!physicalNic || *physicalNic) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
- return -1;
- }
+ ESX_VI_CHECK_ARG_LIST(physicalNic);
if (esxVI_LookupPhysicalNicList(ctx, &physicalNicList) < 0)
goto cleanup;
esxVI_PhysicalNic *physicalNicList = NULL;
esxVI_PhysicalNic *candidate = NULL;
- if (!physicalNic || *physicalNic) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
- return -1;
- }
+ ESX_VI_CHECK_ARG_LIST(physicalNic);
if (esxVI_LookupPhysicalNicList(ctx, &physicalNicList) < 0)
goto cleanup;
esxVI_ObjectContent *hostSystem = NULL;
esxVI_DynamicProperty *dynamicProperty = NULL;
- if (!hostVirtualSwitchList || *hostVirtualSwitchList) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
- return -1;
- }
+ ESX_VI_CHECK_ARG_LIST(hostVirtualSwitchList);
if (esxVI_String_AppendValueToList(&propertyNameList,
"config.network.vswitch") < 0 ||
esxVI_HostVirtualSwitch *hostVirtualSwitchList = NULL;
esxVI_HostVirtualSwitch *candidate = NULL;
- if (!hostVirtualSwitch || *hostVirtualSwitch) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
- return -1;
- }
+ ESX_VI_CHECK_ARG_LIST(hostVirtualSwitch);
if (esxVI_LookupHostVirtualSwitchList(ctx, &hostVirtualSwitchList) < 0)
goto cleanup;
esxVI_ObjectContent *hostSystem = NULL;
esxVI_DynamicProperty *dynamicProperty = NULL;
- if (!hostPortGroupList || *hostPortGroupList) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
- return -1;
- }
+ ESX_VI_CHECK_ARG_LIST(hostPortGroupList);
if (esxVI_String_AppendValueToList(&propertyNameList,
"config.network.portgroup") < 0 ||
bool blocked;
esxVI_TaskInfo *taskInfo = NULL;
- if (!errorMessage || *errorMessage) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
- return -1;
- }
+ ESX_VI_CHECK_ARG_LIST(errorMessage);
if (VIR_STRDUP(version, "") < 0)
return -1;
bool found = false;
esxVI_HostInternetScsiTargetTransport *candidate = NULL;
- if (!hostScsiTopologyLunList || *hostScsiTopologyLunList) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
- return -1;
- }
+ ESX_VI_CHECK_ARG_LIST(hostScsiTopologyLunList);
if (esxVI_String_AppendValueToList
(&propertyNameList,
esxVI_HostScsiTopologyLun *hostScsiTopologyLun;
bool found = false;
- if (!poolName || *poolName) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
- return -1;
- }
+ ESX_VI_CHECK_ARG_LIST(poolName);
if (esxVI_String_AppendValueToList
(&propertyNameList,
int \
esxVI_##__type##_Alloc(esxVI_##__type **ptrptr) \
{ \
- if (!ptrptr || *ptrptr) { \
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); \
- return -1; \
- } \
+ ESX_VI_CHECK_ARG_LIST(ptrptr); \
\
if (VIR_ALLOC(*ptrptr) < 0) \
return -1; \
int \
esxVI_##_type##_DeepCopy(esxVI_##_type **dest, esxVI_##_type *src) \
{ \
- if (!dest || *dest) { \
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s", \
- _("Invalid argument")); \
- return -1; \
- } \
+ ESX_VI_CHECK_ARG_LIST(dest); \
\
if (!src) { \
return 0; \
int
esxVI_AnyType_DeepCopy(esxVI_AnyType **dest, esxVI_AnyType *src)
{
- if (!dest || *dest) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
- return -1;
- }
+ ESX_VI_CHECK_ARG_LIST(dest);
if (!src)
return 0;
{
long long int number;
- if (!anyType || *anyType) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
- return -1;
- }
+ ESX_VI_CHECK_ARG_LIST(anyType);
if (esxVI_AnyType_Alloc(anyType) < 0)
return -1;
int
esxVI_String_DeepCopyValue(char **dest, const char *src)
{
- if (!dest || *dest) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
- return -1;
- }
+ ESX_VI_CHECK_ARG_LIST(dest);
if (!src)
return 0;
int
esxVI_String_Deserialize(xmlNodePtr node, esxVI_String **string)
{
- if (!string || *string) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
- return -1;
- }
+ ESX_VI_CHECK_ARG_LIST(string);
if (esxVI_String_Alloc(string) < 0 ||
esxVI_String_DeserializeValue(node, &(*string)->value) < 0) {
int
esxVI_String_DeserializeValue(xmlNodePtr node, char **value)
{
- if (!value || *value) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
- return -1;
- }
+ ESX_VI_CHECK_ARG_LIST(value);
*value = (char *)xmlNodeListGetString(node->doc, node->children, 1);
int
esxVI_DateTime_Deserialize(xmlNodePtr node, esxVI_DateTime **dateTime)
{
- if (!dateTime || *dateTime) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
- return -1;
- }
+ ESX_VI_CHECK_ARG_LIST(dateTime);
if (esxVI_DateTime_Alloc(dateTime) < 0)
return -1;
int
esxVI_MethodFault_Deserialize(xmlNodePtr node, esxVI_MethodFault **methodFault)
{
- if (!methodFault || *methodFault) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
- return -1;
- }
+ ESX_VI_CHECK_ARG_LIST(methodFault);
if (esxVI_MethodFault_Alloc(methodFault) < 0)
return -1;
esxVI_ManagedObjectReference_Deserialize
(xmlNodePtr node, esxVI_ManagedObjectReference **managedObjectReference)
{
- if (!managedObjectReference || *managedObjectReference) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
- return -1;
- }
+ ESX_VI_CHECK_ARG_LIST(managedObjectReference);
if (esxVI_ManagedObjectReference_Alloc(managedObjectReference) < 0)
return -1;