From: "Daniel P. Berrange" <berrange(a)redhat.com>
Update the VMX shared code to use virReportError instead of
the VMX_ERROR custom macro
Signed-off-by: Daniel P. Berrange <berrange(a)redhat.com>
---
cfg.mk | 1 -
src/vmx/vmx.c | 738 ++++++++++++++++++++++++++++-----------------------------
2 files changed, 367 insertions(+), 372 deletions(-)
diff --git a/cfg.mk b/cfg.mk
index c6f921c..6be785a 100644
--- a/cfg.mk
+++ b/cfg.mk
@@ -507,7 +507,6 @@ sc_avoid_attribute_unused_in_header:
msg_gen_function =
msg_gen_function += VIR_ERROR
-msg_gen_function += VMX_ERROR
msg_gen_function += lxcError
msg_gen_function += nodeReportError
msg_gen_function += qemuReportError
diff --git a/src/vmx/vmx.c b/src/vmx/vmx.c
index 7357030..f5baf87 100644
--- a/src/vmx/vmx.c
+++ b/src/vmx/vmx.c
@@ -471,10 +471,6 @@ def->parallels[0]...
#define VIR_FROM_THIS VIR_FROM_NONE
-#define VMX_ERROR(code, ...) \
- virReportErrorHelper(VIR_FROM_NONE, code, __FILE__, __FUNCTION__, \
- __LINE__, __VA_ARGS__)
-
#define VMX_BUILD_NAME_EXTRA(_suffix, _extra) \
snprintf(_suffix##_name, sizeof(_suffix##_name), "%s."_extra, prefix);
@@ -586,8 +582,8 @@ virVMXConvertToUTF8(const char *encoding, const char *string)
handler = xmlFindCharEncodingHandler(encoding);
if (handler == NULL) {
- VMX_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("libxml2 doesn't handle %s encoding"), encoding);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("libxml2 doesn't handle %s encoding"), encoding);
return NULL;
}
@@ -595,8 +591,8 @@ virVMXConvertToUTF8(const char *encoding, const char *string)
utf8 = xmlBufferCreate();
if (xmlCharEncInFunc(handler, utf8, input) < 0) {
- VMX_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("Could not convert from %s to UTF-8 encoding"), encoding);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Could not convert from %s to UTF-8 encoding"),
encoding);
goto cleanup;
}
@@ -627,14 +623,14 @@ virVMXGetConfigString(virConfPtr conf, const char *name, char
**string,
return 0;
}
- VMX_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("Missing essential config entry '%s'"), name);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Missing essential config entry '%s'"),
name);
return -1;
}
if (value->type != VIR_CONF_STRING) {
- VMX_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("Config entry '%s' must be a string"), name);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Config entry '%s' must be a string"), name);
return -1;
}
@@ -643,8 +639,8 @@ virVMXGetConfigString(virConfPtr conf, const char *name, char
**string,
return 0;
}
- VMX_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("Missing essential config entry '%s'"), name);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Missing essential config entry '%s'"),
name);
return -1;
}
@@ -672,15 +668,15 @@ virVMXGetConfigUUID(virConfPtr conf, const char *name, unsigned char
*uuid,
if (optional) {
return 0;
} else {
- VMX_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("Missing essential config entry '%s'"), name);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Missing essential config entry '%s'"),
name);
return -1;
}
}
if (value->type != VIR_CONF_STRING) {
- VMX_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("Config entry '%s' must be a string"), name);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Config entry '%s' must be a string"), name);
return -1;
}
@@ -688,15 +684,15 @@ virVMXGetConfigUUID(virConfPtr conf, const char *name, unsigned char
*uuid,
if (optional) {
return 0;
} else {
- VMX_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("Missing essential config entry '%s'"), name);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Missing essential config entry '%s'"),
name);
return -1;
}
}
if (virUUIDParse(value->str, uuid) < 0) {
- VMX_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("Could not parse UUID from string '%s'"),
value->str);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Could not parse UUID from string '%s'"),
value->str);
return -1;
}
@@ -718,8 +714,8 @@ virVMXGetConfigLong(virConfPtr conf, const char *name, long long
*number,
if (optional) {
return 0;
} else {
- VMX_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("Missing essential config entry '%s'"), name);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Missing essential config entry '%s'"),
name);
return -1;
}
}
@@ -729,8 +725,8 @@ virVMXGetConfigLong(virConfPtr conf, const char *name, long long
*number,
if (optional) {
return 0;
} else {
- VMX_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("Missing essential config entry '%s'"),
name);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Missing essential config entry
'%s'"), name);
return -1;
}
}
@@ -738,14 +734,14 @@ virVMXGetConfigLong(virConfPtr conf, const char *name, long long
*number,
if (STRCASEEQ(value->str, "unlimited")) {
*number = -1;
} else if (virStrToLong_ll(value->str, NULL, 10, number) < 0) {
- VMX_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("Config entry '%s' must represent an integer
value"),
- name);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Config entry '%s' must represent an integer
value"),
+ name);
return -1;
}
} else {
- VMX_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("Config entry '%s' must be a string"), name);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Config entry '%s' must be a string"), name);
return -1;
}
@@ -767,8 +763,8 @@ virVMXGetConfigBoolean(virConfPtr conf, const char *name, bool
*boolean_,
if (optional) {
return 0;
} else {
- VMX_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("Missing essential config entry '%s'"), name);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Missing essential config entry '%s'"),
name);
return -1;
}
}
@@ -778,8 +774,8 @@ virVMXGetConfigBoolean(virConfPtr conf, const char *name, bool
*boolean_,
if (optional) {
return 0;
} else {
- VMX_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("Missing essential config entry '%s'"),
name);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Missing essential config entry
'%s'"), name);
return -1;
}
}
@@ -789,14 +785,14 @@ virVMXGetConfigBoolean(virConfPtr conf, const char *name, bool
*boolean_,
} else if (STRCASEEQ(value->str, "false")) {
*boolean_ = 0;
} else {
- VMX_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("Config entry '%s' must represent a boolean value
"
- "(true|false)"), name);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Config entry '%s' must represent a boolean
value "
+ "(true|false)"), name);
return -1;
}
} else {
- VMX_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("Config entry '%s' must be a string"), name);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Config entry '%s' must be a string"), name);
return -1;
}
@@ -811,24 +807,24 @@ virVMXSCSIDiskNameToControllerAndUnit(const char *name, int
*controller, int *un
int idx;
if (! STRPREFIX(name, "sd")) {
- VMX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
- _("Expecting domain XML attribute 'dev' of entry "
- "'devices/disk/target' to start with
'sd'"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Expecting domain XML attribute 'dev' of entry
"
+ "'devices/disk/target' to start with
'sd'"));
return -1;
}
idx = virDiskNameToIndex(name);
if (idx < 0) {
- VMX_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("Could not parse valid disk index from '%s'"),
name);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Could not parse valid disk index from '%s'"),
name);
return -1;
}
/* Each of the 4 SCSI controllers has 1 bus with 15 units each for devices */
if (idx >= (4 * 15)) {
- VMX_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("SCSI disk index (parsed from '%s') is too large"),
name);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("SCSI disk index (parsed from '%s') is too
large"), name);
return -1;
}
@@ -851,24 +847,24 @@ virVMXIDEDiskNameToBusAndUnit(const char *name, int *bus, int
*unit)
int idx;
if (! STRPREFIX(name, "hd")) {
- VMX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
- _("Expecting domain XML attribute 'dev' of entry "
- "'devices/disk/target' to start with
'hd'"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Expecting domain XML attribute 'dev' of entry
"
+ "'devices/disk/target' to start with
'hd'"));
return -1;
}
idx = virDiskNameToIndex(name);
if (idx < 0) {
- VMX_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("Could not parse valid disk index from '%s'"),
name);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Could not parse valid disk index from '%s'"),
name);
return -1;
}
/* The IDE controller has 2 buses with 2 units each for devices */
if (idx >= (2 * 2)) {
- VMX_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("IDE disk index (parsed from '%s') is too large"),
name);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("IDE disk index (parsed from '%s') is too
large"), name);
return -1;
}
@@ -886,24 +882,24 @@ virVMXFloppyDiskNameToUnit(const char *name, int *unit)
int idx;
if (! STRPREFIX(name, "fd")) {
- VMX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
- _("Expecting domain XML attribute 'dev' of entry "
- "'devices/disk/target' to start with
'fd'"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Expecting domain XML attribute 'dev' of entry
"
+ "'devices/disk/target' to start with
'fd'"));
return -1;
}
idx = virDiskNameToIndex(name);
if (idx < 0) {
- VMX_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("Could not parse valid disk index from '%s'"),
name);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Could not parse valid disk index from '%s'"),
name);
return -1;
}
/* The FDC controller has 1 bus with 2 units for devices */
if (idx >= 2) {
- VMX_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("Floppy disk index (parsed from '%s') is too
large"), name);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Floppy disk index (parsed from '%s') is too
large"), name);
return -1;
}
@@ -923,9 +919,9 @@ virVMXVerifyDiskAddress(virCapsPtr caps, virDomainDiskDefPtr disk)
memset(&def, 0, sizeof(def));
if (disk->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_DRIVE) {
- VMX_ERROR(VIR_ERR_CONFIG_UNSUPPORTED,
- _("Unsupported disk address type '%s'"),
- virDomainDeviceAddressTypeToString(disk->info.type));
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("Unsupported disk address type '%s'"),
+ virDomainDeviceAddressTypeToString(disk->info.type));
return -1;
}
@@ -935,88 +931,88 @@ virVMXVerifyDiskAddress(virCapsPtr caps, virDomainDiskDefPtr disk)
def.bus = disk->bus;
if (virDomainDiskDefAssignAddress(caps, &def) < 0) {
- VMX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
- _("Could not verify disk address"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Could not verify disk address"));
return -1;
}
if (def.info.addr.drive.controller != drive->controller ||
def.info.addr.drive.bus != drive->bus ||
def.info.addr.drive.unit != drive->unit) {
- VMX_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("Disk address %d:%d:%d doesn't match target device
'%s'"),
- drive->controller, drive->bus, drive->unit, disk->dst);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Disk address %d:%d:%d doesn't match target device
'%s'"),
+ drive->controller, drive->bus, drive->unit,
disk->dst);
return -1;
}
/* drive->{controller|bus|unit} is unsigned, no >= 0 checks are necessary */
if (disk->bus == VIR_DOMAIN_DISK_BUS_SCSI) {
if (drive->controller > 3) {
- VMX_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("SCSI controller index %d out of [0..3] range"),
- drive->controller);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("SCSI controller index %d out of [0..3] range"),
+ drive->controller);
return -1;
}
if (drive->bus != 0) {
- VMX_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("SCSI bus index %d out of [0] range"),
- drive->bus);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("SCSI bus index %d out of [0] range"),
+ drive->bus);
return -1;
}
if (drive->unit > 15 || drive->unit == 7) {
- VMX_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("SCSI unit index %d out of [0..6,8..15] range"),
- drive->unit);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("SCSI unit index %d out of [0..6,8..15] range"),
+ drive->unit);
return -1;
}
} else if (disk->bus == VIR_DOMAIN_DISK_BUS_IDE) {
if (drive->controller != 0) {
- VMX_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("IDE controller index %d out of [0] range"),
- drive->controller);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("IDE controller index %d out of [0] range"),
+ drive->controller);
return -1;
}
if (drive->bus > 1) {
- VMX_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("IDE bus index %d out of [0..1] range"),
- drive->bus);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("IDE bus index %d out of [0..1] range"),
+ drive->bus);
return -1;
}
if (drive->unit > 1) {
- VMX_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("IDE unit index %d out of [0..1] range"),
- drive->unit);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("IDE unit index %d out of [0..1] range"),
+ drive->unit);
return -1;
}
} else if (disk->bus == VIR_DOMAIN_DISK_BUS_FDC) {
if (drive->controller != 0) {
- VMX_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("FDC controller index %d out of [0] range"),
- drive->controller);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("FDC controller index %d out of [0] range"),
+ drive->controller);
return -1;
}
if (drive->bus != 0) {
- VMX_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("FDC bus index %d out of [0] range"),
- drive->bus);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("FDC bus index %d out of [0] range"),
+ drive->bus);
return -1;
}
if (drive->unit > 1) {
- VMX_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("FDC unit index %d out of [0..1] range"),
- drive->unit);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("FDC unit index %d out of [0..1] range"),
+ drive->unit);
return -1;
}
} else {
- VMX_ERROR(VIR_ERR_CONFIG_UNSUPPORTED,
- _("Unsupported bus type '%s'"),
- virDomainDiskBusTypeToString(disk->bus));
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("Unsupported bus type '%s'"),
+ virDomainDiskBusTypeToString(disk->bus));
return -1;
}
@@ -1046,8 +1042,8 @@ virVMXHandleLegacySCSIDiskDriverName(virDomainDefPtr def,
model = virDomainControllerModelSCSITypeFromString(disk->driverName);
if (model < 0) {
- VMX_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("Unknown driver name '%s'"), disk->driverName);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Unknown driver name '%s'"),
disk->driverName);
return -1;
}
@@ -1059,20 +1055,20 @@ virVMXHandleLegacySCSIDiskDriverName(virDomainDefPtr def,
}
if (controller == NULL) {
- VMX_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("Missing SCSI controller for index %d"),
- disk->info.addr.drive.controller);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Missing SCSI controller for index %d"),
+ disk->info.addr.drive.controller);
return -1;
}
if (controller->model == -1) {
controller->model = model;
} else if (controller->model != model) {
- VMX_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("Inconsistent SCSI controller model ('%s' is not
'%s') "
- "for SCSI controller index %d"), disk->driverName,
- virDomainControllerModelSCSITypeToString(controller->model),
- controller->idx);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Inconsistent SCSI controller model ('%s' is not
'%s') "
+ "for SCSI controller index %d"), disk->driverName,
+ virDomainControllerModelSCSITypeToString(controller->model),
+ controller->idx);
return -1;
}
@@ -1148,10 +1144,10 @@ virVMXGatherSCSIControllers(virVMXContext *ctx, virDomainDefPtr
def,
* have inconsistent SCSI controller models */
for (k = 0; k < count; ++k) {
if (autodetectedModels[k] != autodetectedModels[0]) {
- VMX_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("Disks on SCSI controller %d have inconsistent
"
- "controller models, cannot autodetect model"),
- controller->idx);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Disks on SCSI controller %d have inconsistent
"
+ "controller models, cannot autodetect
model"),
+ controller->idx);
goto cleanup;
}
}
@@ -1164,11 +1160,11 @@ virVMXGatherSCSIControllers(virVMXContext *ctx, virDomainDefPtr
def,
controller->model != VIR_DOMAIN_CONTROLLER_MODEL_SCSI_LSILOGIC &&
controller->model != VIR_DOMAIN_CONTROLLER_MODEL_SCSI_LSISAS1068
&&
controller->model != VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VMPVSCSI) {
- VMX_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("Expecting domain XML attribute 'model' of entry
"
- "'controller' to be 'buslogic' or
'lsilogic' or "
- "'lsisas1068' or 'vmpvscsi' but found
'%s'"),
- virDomainControllerModelSCSITypeToString(controller->model));
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Expecting domain XML attribute 'model' of
entry "
+ "'controller' to be 'buslogic' or
'lsilogic' or "
+ "'lsisas1068' or 'vmpvscsi' but found
'%s'"),
+
virDomainControllerModelSCSITypeToString(controller->model));
goto cleanup;
}
@@ -1216,8 +1212,8 @@ virVMXParseConfig(virVMXContext *ctx, virCapsPtr caps, const char
*vmx)
int unit;
if (ctx->parseFileName == NULL) {
- VMX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
- _("virVMXContext has no parseFileName function set"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("virVMXContext has no parseFileName function set"));
return NULL;
}
@@ -1269,9 +1265,9 @@ virVMXParseConfig(virVMXContext *ctx, virCapsPtr caps, const char
*vmx)
}
if (config_version != 8) {
- VMX_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("Expecting VMX entry 'config.version' to be 8 but found
"
- "%lld"), config_version);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Expecting VMX entry 'config.version' to be 8 but
found "
+ "%lld"), config_version);
goto cleanup;
}
@@ -1283,10 +1279,10 @@ virVMXParseConfig(virVMXContext *ctx, virCapsPtr caps, const char
*vmx)
if (virtualHW_version != 4 && virtualHW_version != 7 &&
virtualHW_version != 8) {
- VMX_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("Expecting VMX entry 'virtualHW.version' to be 4, 7 or 8
"
- "but found %lld"),
- virtualHW_version);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Expecting VMX entry 'virtualHW.version' to be 4, 7
or 8 "
+ "but found %lld"),
+ virtualHW_version);
goto cleanup;
}
@@ -1304,8 +1300,8 @@ virVMXParseConfig(virVMXContext *ctx, virCapsPtr caps, const char
*vmx)
if (def->name != NULL) {
if (virVMXUnescapeHexPercent(def->name) < 0 ||
virVMXUnescapeHexPipe(def->name) < 0) {
- VMX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
- _("VMX entry 'name' contains invalid escape
sequence"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("VMX entry 'name' contains invalid escape
sequence"));
goto cleanup;
}
}
@@ -1318,9 +1314,9 @@ virVMXParseConfig(virVMXContext *ctx, virCapsPtr caps, const char
*vmx)
if (def->description != NULL) {
if (virVMXUnescapeHexPipe(def->description) < 0) {
- VMX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
- _("VMX entry 'annotation' contains invalid escape
"
- "sequence"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("VMX entry 'annotation' contains invalid escape
"
+ "sequence"));
goto cleanup;
}
}
@@ -1331,9 +1327,9 @@ virVMXParseConfig(virVMXContext *ctx, virCapsPtr caps, const char
*vmx)
}
if (memsize <= 0 || memsize % 4 != 0) {
- VMX_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("Expecting VMX entry 'memsize' to be an unsigned "
- "integer (multiple of 4) but found %lld"), memsize);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Expecting VMX entry 'memsize' to be an unsigned
"
+ "integer (multiple of 4) but found %lld"), memsize);
goto cleanup;
}
@@ -1377,9 +1373,9 @@ virVMXParseConfig(virVMXContext *ctx, virCapsPtr caps, const char
*vmx)
}
if (numvcpus <= 0 || (numvcpus % 2 != 0 && numvcpus != 1)) {
- VMX_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("Expecting VMX entry 'numvcpus' to be an unsigned
"
- "integer (1 or a multiple of 2) but found %lld"),
numvcpus);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Expecting VMX entry 'numvcpus' to be an unsigned
"
+ "integer (1 or a multiple of 2) but found %lld"),
numvcpus);
goto cleanup;
}
@@ -1409,17 +1405,17 @@ virVMXParseConfig(virVMXContext *ctx, virCapsPtr caps, const char
*vmx)
number = virParseNumber(¤t);
if (number < 0) {
- VMX_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("Expecting VMX entry 'sched.cpu.affinity' to be
"
- "a comma separated list of unsigned integers but "
- "found '%s'"), sched_cpu_affinity);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Expecting VMX entry 'sched.cpu.affinity'
to be "
+ "a comma separated list of unsigned integers but
"
+ "found '%s'"), sched_cpu_affinity);
goto cleanup;
}
if (number >= VIR_DOMAIN_CPUMASK_LEN) {
- VMX_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("VMX entry 'sched.cpu.affinity' contains a %d,
"
- "this value is too large"), number);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("VMX entry 'sched.cpu.affinity' contains a
%d, "
+ "this value is too large"), number);
goto cleanup;
}
@@ -1437,10 +1433,10 @@ virVMXParseConfig(virVMXContext *ctx, virCapsPtr caps, const char
*vmx)
} else if (*current == '\0') {
break;
} else {
- VMX_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("Expecting VMX entry 'sched.cpu.affinity' to be
"
- "a comma separated list of unsigned integers but "
- "found '%s'"), sched_cpu_affinity);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Expecting VMX entry 'sched.cpu.affinity'
to be "
+ "a comma separated list of unsigned integers but
"
+ "found '%s'"), sched_cpu_affinity);
goto cleanup;
}
@@ -1448,10 +1444,10 @@ virVMXParseConfig(virVMXContext *ctx, virCapsPtr caps, const char
*vmx)
}
if (count < numvcpus) {
- VMX_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("Expecting VMX entry 'sched.cpu.affinity' to contain
"
- "at least as many values as 'numvcpus' (%lld) but
"
- "found only %d value(s)"), numvcpus, count);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Expecting VMX entry 'sched.cpu.affinity' to
contain "
+ "at least as many values as 'numvcpus' (%lld)
but "
+ "found only %d value(s)"), numvcpus, count);
goto cleanup;
}
}
@@ -1472,10 +1468,10 @@ virVMXParseConfig(virVMXContext *ctx, virCapsPtr caps, const char
*vmx)
def->cputune.shares = def->vcpus * 2000;
} else if (virStrToLong_ul(sched_cpu_shares, NULL, 10,
&def->cputune.shares) < 0) {
- VMX_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("Expecting VMX entry 'sched.cpu.shares' to be an
"
- "unsigned integer or 'low', 'normal' or
'high' but "
- "found '%s'"), sched_cpu_shares);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Expecting VMX entry 'sched.cpu.shares' to be
an "
+ "unsigned integer or 'low', 'normal' or
'high' but "
+ "found '%s'"), sched_cpu_shares);
goto cleanup;
}
}
@@ -1633,7 +1629,7 @@ virVMXParseConfig(virVMXContext *ctx, virCapsPtr caps, const char
*vmx)
/* def:controllers */
if (virDomainDefAddImplicitControllers(def) < 0) {
- VMX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Could not add
controllers"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Could not add
controllers"));
goto cleanup;
}
@@ -1641,9 +1637,9 @@ virVMXParseConfig(virVMXContext *ctx, virCapsPtr caps, const char
*vmx)
if (def->controllers[controller]->type == VIR_DOMAIN_CONTROLLER_TYPE_SCSI)
{
if (def->controllers[controller]->idx < 0 ||
def->controllers[controller]->idx > 3) {
- VMX_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("SCSI controller index %d out of [0..3] range"),
- def->controllers[controller]->idx);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("SCSI controller index %d out of [0..3]
range"),
+ def->controllers[controller]->idx);
goto cleanup;
}
@@ -1762,7 +1758,7 @@ virVMXParseVNC(virConfPtr conf, virDomainGraphicsDefPtr *def)
char *listenAddr = NULL;
if (def == NULL || *def != NULL) {
- VMX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid
argument"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid
argument"));
return -1;
}
@@ -1837,14 +1833,14 @@ virVMXParseSCSIController(virConfPtr conf, int controller, bool
*present,
char *tmp;
if (virtualDev == NULL || *virtualDev != -1) {
- VMX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid
argument"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid
argument"));
return -1;
}
if (controller < 0 || controller > 3) {
- VMX_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("SCSI controller index %d out of [0..3] range"),
- controller);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("SCSI controller index %d out of [0..3] range"),
+ controller);
return -1;
}
@@ -1880,10 +1876,10 @@ virVMXParseSCSIController(virConfPtr conf, int controller, bool
*present,
*virtualDev != VIR_DOMAIN_CONTROLLER_MODEL_SCSI_LSILOGIC &&
*virtualDev != VIR_DOMAIN_CONTROLLER_MODEL_SCSI_LSISAS1068 &&
*virtualDev != VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VMPVSCSI)) {
- VMX_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("Expecting VMX entry '%s' to be 'buslogic'
or 'lsilogic' "
- "or 'lsisas1068' or 'pvscsi' but found
'%s'"),
- virtualDev_name, virtualDev_string);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Expecting VMX entry '%s' to be
'buslogic' or 'lsilogic' "
+ "or 'lsisas1068' or 'pvscsi' but found
'%s'"),
+ virtualDev_name, virtualDev_string);
goto cleanup;
}
}
@@ -1945,7 +1941,7 @@ virVMXParseDisk(virVMXContext *ctx, virCapsPtr caps, virConfPtr
conf,
bool writeThrough = false;
if (def == NULL || *def != NULL) {
- VMX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid
argument"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid
argument"));
return -1;
}
@@ -1962,16 +1958,16 @@ virVMXParseDisk(virVMXContext *ctx, virCapsPtr caps, virConfPtr
conf,
device == VIR_DOMAIN_DISK_DEVICE_CDROM) {
if (busType == VIR_DOMAIN_DISK_BUS_SCSI) {
if (controllerOrBus < 0 || controllerOrBus > 3) {
- VMX_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("SCSI controller index %d out of [0..3] range"),
- controllerOrBus);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("SCSI controller index %d out of [0..3]
range"),
+ controllerOrBus);
goto cleanup;
}
if (unit < 0 || unit > 15 || unit == 7) {
- VMX_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("SCSI unit index %d out of [0..6,8..15] range"),
- unit);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("SCSI unit index %d out of [0..6,8..15]
range"),
+ unit);
goto cleanup;
}
@@ -1989,15 +1985,15 @@ virVMXParseDisk(virVMXContext *ctx, virCapsPtr caps, virConfPtr
conf,
}
} else if (busType == VIR_DOMAIN_DISK_BUS_IDE) {
if (controllerOrBus < 0 || controllerOrBus > 1) {
- VMX_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("IDE bus index %d out of [0..1] range"),
- controllerOrBus);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("IDE bus index %d out of [0..1] range"),
+ controllerOrBus);
goto cleanup;
}
if (unit < 0 || unit > 1) {
- VMX_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("IDE unit index %d out of [0..1] range"), unit);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("IDE unit index %d out of [0..1] range"),
unit);
goto cleanup;
}
@@ -2012,25 +2008,25 @@ virVMXParseDisk(virVMXContext *ctx, virCapsPtr caps, virConfPtr
conf,
goto cleanup;
}
} else {
- VMX_ERROR(VIR_ERR_CONFIG_UNSUPPORTED,
- _("Unsupported bus type '%s' for device type
'%s'"),
- virDomainDiskBusTypeToString(busType),
- virDomainDiskDeviceTypeToString(device));
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("Unsupported bus type '%s' for device type
'%s'"),
+ virDomainDiskBusTypeToString(busType),
+ virDomainDiskDeviceTypeToString(device));
goto cleanup;
}
} else if (device == VIR_DOMAIN_DISK_DEVICE_FLOPPY) {
if (busType == VIR_DOMAIN_DISK_BUS_FDC) {
if (controllerOrBus != 0) {
- VMX_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("FDC controller index %d out of [0] range"),
- controllerOrBus);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("FDC controller index %d out of [0] range"),
+ controllerOrBus);
goto cleanup;
}
if (unit < 0 || unit > 1) {
- VMX_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("FDC unit index %d out of [0..1] range"),
- unit);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("FDC unit index %d out of [0..1] range"),
+ unit);
goto cleanup;
}
@@ -2045,16 +2041,16 @@ virVMXParseDisk(virVMXContext *ctx, virCapsPtr caps, virConfPtr
conf,
goto cleanup;
}
} else {
- VMX_ERROR(VIR_ERR_CONFIG_UNSUPPORTED,
- _("Unsupported bus type '%s' for device type
'%s'"),
- virDomainDiskBusTypeToString(busType),
- virDomainDiskDeviceTypeToString(device));
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("Unsupported bus type '%s' for device type
'%s'"),
+ virDomainDiskBusTypeToString(busType),
+ virDomainDiskDeviceTypeToString(device));
goto cleanup;
}
} else {
- VMX_ERROR(VIR_ERR_CONFIG_UNSUPPORTED,
- _("Unsupported device type '%s'"),
- virDomainDiskDeviceTypeToString(device));
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("Unsupported device type '%s'"),
+ virDomainDiskDeviceTypeToString(device));
goto cleanup;
}
@@ -2124,18 +2120,18 @@ virVMXParseDisk(virVMXContext *ctx, virCapsPtr caps, virConfPtr
conf,
if (busType == VIR_DOMAIN_DISK_BUS_SCSI &&
STRCASENEQ(deviceType, "scsi-hardDisk") &&
STRCASENEQ(deviceType, "disk")) {
- VMX_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("Expecting VMX entry '%s' to be
'scsi-hardDisk' "
- "or 'disk' but found '%s'"),
deviceType_name,
- deviceType);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Expecting VMX entry '%s' to be
'scsi-hardDisk' "
+ "or 'disk' but found
'%s'"), deviceType_name,
+ deviceType);
goto cleanup;
} else if (busType == VIR_DOMAIN_DISK_BUS_IDE &&
STRCASENEQ(deviceType, "ata-hardDisk") &&
STRCASENEQ(deviceType, "disk")) {
- VMX_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("Expecting VMX entry '%s' to be
'ata-hardDisk' "
- "or 'disk' but found '%s'"),
deviceType_name,
- deviceType);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Expecting VMX entry '%s' to be
'ata-hardDisk' "
+ "or 'disk' but found
'%s'"), deviceType_name,
+ deviceType);
goto cleanup;
}
}
@@ -2158,18 +2154,18 @@ virVMXParseDisk(virVMXContext *ctx, virCapsPtr caps, virConfPtr
conf,
*/
goto ignore;
} else {
- VMX_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("Invalid or not yet handled value '%s' for VMX entry
"
- "'%s'"), fileName, fileName_name);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Invalid or not yet handled value '%s' for VMX
entry "
+ "'%s'"), fileName, fileName_name);
goto cleanup;
}
} else if (device == VIR_DOMAIN_DISK_DEVICE_CDROM) {
if (virFileHasSuffix(fileName, ".iso")) {
if (deviceType != NULL) {
if (STRCASENEQ(deviceType, "cdrom-image")) {
- VMX_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("Expecting VMX entry '%s' to be
'cdrom-image' "
- "but found '%s'"), deviceType_name,
deviceType);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Expecting VMX entry '%s' to be
'cdrom-image' "
+ "but found '%s'"),
deviceType_name, deviceType);
goto cleanup;
}
}
@@ -2194,18 +2190,18 @@ virVMXParseDisk(virVMXContext *ctx, virCapsPtr caps, virConfPtr
conf,
fileName = NULL;
} else {
- VMX_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("Invalid or not yet handled value '%s' for VMX entry
"
- "'%s'"), fileName, fileName_name);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Invalid or not yet handled value '%s' for VMX
entry "
+ "'%s'"), fileName, fileName_name);
goto cleanup;
}
} else if (device == VIR_DOMAIN_DISK_DEVICE_FLOPPY) {
if (virFileHasSuffix(fileName, ".flp")) {
if (fileType != NULL) {
if (STRCASENEQ(fileType, "file")) {
- VMX_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("Expecting VMX entry '%s' to be
'file' but "
- "found '%s'"), fileType_name,
fileType);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Expecting VMX entry '%s' to be
'file' but "
+ "found '%s'"), fileType_name,
fileType);
goto cleanup;
}
}
@@ -2222,20 +2218,20 @@ virVMXParseDisk(virVMXContext *ctx, virCapsPtr caps, virConfPtr
conf,
fileName = NULL;
} else {
- VMX_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("Invalid or not yet handled value '%s' for VMX entry
"
- "'%s'"), fileName, fileName_name);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Invalid or not yet handled value '%s' for VMX
entry "
+ "'%s'"), fileName, fileName_name);
goto cleanup;
}
} else {
- VMX_ERROR(VIR_ERR_CONFIG_UNSUPPORTED, _("Unsupported device type
'%s'"),
- virDomainDiskDeviceTypeToString(device));
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("Unsupported device type
'%s'"),
+ virDomainDiskDeviceTypeToString(device));
goto cleanup;
}
if (virDomainDiskDefAssignAddress(caps, *def) < 0) {
- VMX_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("Could not assign address to disk '%s'"),
(*def)->src);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Could not assign address to disk '%s'"),
(*def)->src);
goto cleanup;
}
@@ -2302,14 +2298,14 @@ virVMXParseEthernet(virConfPtr conf, int controller,
virDomainNetDefPtr *def)
char *networkName = NULL;
if (def == NULL || *def != NULL) {
- VMX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid
argument"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid
argument"));
return -1;
}
if (controller < 0 || controller > 3) {
- VMX_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("Ethernet controller index %d out of [0..3] range"),
- controller);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Ethernet controller index %d out of [0..3] range"),
+ controller);
return -1;
}
@@ -2366,26 +2362,26 @@ virVMXParseEthernet(virConfPtr conf, int controller,
virDomainNetDefPtr *def)
STRCASEEQ(addressType, "vpx")) {
if (generatedAddress != NULL) {
if (virMacAddrParse(generatedAddress, &(*def)->mac) < 0) {
- VMX_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("Expecting VMX entry '%s' to be MAC address but
"
- "found '%s'"), generatedAddress_name,
- generatedAddress);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Expecting VMX entry '%s' to be MAC address
but "
+ "found '%s'"), generatedAddress_name,
+ generatedAddress);
goto cleanup;
}
}
} else if (STRCASEEQ(addressType, "static")) {
if (address != NULL) {
if (virMacAddrParse(address, &(*def)->mac) < 0) {
- VMX_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("Expecting VMX entry '%s' to be MAC address but
"
- "found '%s'"), address_name, address);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Expecting VMX entry '%s' to be MAC address
but "
+ "found '%s'"), address_name,
address);
goto cleanup;
}
}
} else {
- VMX_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("Expecting VMX entry '%s' to be 'generated' or
'static' or "
- "'vpx' but found '%s'"), addressType_name,
addressType);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Expecting VMX entry '%s' to be 'generated'
or 'static' or "
+ "'vpx' but found '%s'"),
addressType_name, addressType);
goto cleanup;
}
@@ -2400,10 +2396,10 @@ virVMXParseEthernet(virConfPtr conf, int controller,
virDomainNetDefPtr *def)
STRCASENEQ(virtualDev, "vmxnet") &&
STRCASENEQ(virtualDev, "vmxnet3") &&
STRCASENEQ(virtualDev, "e1000")) {
- VMX_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("Expecting VMX entry '%s' to be 'vlance' or
'vmxnet' or "
- "'vmxnet3' or 'e1000' but found
'%s'"), virtualDev_name,
- virtualDev);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Expecting VMX entry '%s' to be
'vlance' or 'vmxnet' or "
+ "'vmxnet3' or 'e1000' but found
'%s'"), virtualDev_name,
+ virtualDev);
goto cleanup;
}
@@ -2452,9 +2448,9 @@ virVMXParseEthernet(virConfPtr conf, int controller,
virDomainNetDefPtr *def)
networkName = NULL;
} else if (STRCASEEQ(connectionType, "hostonly")) {
/* FIXME */
- VMX_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("No yet handled value '%s' for VMX entry
'%s'"),
- connectionType, connectionType_name);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("No yet handled value '%s' for VMX entry
'%s'"),
+ connectionType, connectionType_name);
goto cleanup;
} else if (STRCASEEQ(connectionType, "nat")) {
(*def)->type = VIR_DOMAIN_NET_TYPE_USER;
@@ -2471,9 +2467,9 @@ virVMXParseEthernet(virConfPtr conf, int controller,
virDomainNetDefPtr *def)
networkName = NULL;
vnet = NULL;
} else {
- VMX_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("Invalid value '%s' for VMX entry '%s'"),
connectionType,
- connectionType_name);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Invalid value '%s' for VMX entry
'%s'"), connectionType,
+ connectionType_name);
goto cleanup;
}
@@ -2531,13 +2527,13 @@ virVMXParseSerial(virVMXContext *ctx, virConfPtr conf, int port,
virURIPtr parsedUri = NULL;
if (def == NULL || *def != NULL) {
- VMX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid
argument"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid
argument"));
return -1;
}
if (port < 0 || port > 3) {
- VMX_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("Serial port index %d out of [0..3] range"), port);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Serial port index %d out of [0..3] range"), port);
return -1;
}
@@ -2622,9 +2618,9 @@ virVMXParseSerial(virVMXContext *ctx, virConfPtr conf, int port,
goto cleanup;
if (parsedUri->port == 0) {
- VMX_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("VMX entry '%s' doesn't contain a port
part"),
- fileName_name);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("VMX entry '%s' doesn't contain a port
part"),
+ fileName_name);
goto cleanup;
}
@@ -2659,9 +2655,9 @@ virVMXParseSerial(virVMXContext *ctx, virConfPtr conf, int port,
STRCASEEQ(parsedUri->scheme, "tcp6+ssl")) {
(*def)->source.data.tcp.protocol = VIR_DOMAIN_CHR_TCP_PROTOCOL_TLS;
} else {
- VMX_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("VMX entry '%s' contains unsupported scheme
'%s'"),
- fileName_name, parsedUri->scheme);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("VMX entry '%s' contains unsupported scheme
'%s'"),
+ fileName_name, parsedUri->scheme);
goto cleanup;
}
@@ -2670,15 +2666,15 @@ virVMXParseSerial(virVMXContext *ctx, virConfPtr conf, int port,
} else if (STRCASEEQ(network_endPoint, "client")) {
(*def)->source.data.tcp.listen = false;
} else {
- VMX_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("Expecting VMX entry '%s' to be 'server' or
'client' "
- "but found '%s'"), network_endPoint_name,
network_endPoint);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Expecting VMX entry '%s' to be
'server' or 'client' "
+ "but found '%s'"), network_endPoint_name,
network_endPoint);
goto cleanup;
}
} else {
- VMX_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("Expecting VMX entry '%s' to be 'device',
'file' or 'pipe' "
- "or 'network' but found '%s'"),
fileType_name, fileType);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Expecting VMX entry '%s' to be 'device',
'file' or 'pipe' "
+ "or 'network' but found '%s'"),
fileType_name, fileType);
goto cleanup;
}
@@ -2728,13 +2724,13 @@ virVMXParseParallel(virVMXContext *ctx, virConfPtr conf, int
port,
char *fileName = NULL;
if (def == NULL || *def != NULL) {
- VMX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid
argument"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid
argument"));
return -1;
}
if (port < 0 || port > 2) {
- VMX_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("Parallel port index %d out of [0..2] range"), port);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Parallel port index %d out of [0..2] range"), port);
return -1;
}
@@ -2795,9 +2791,9 @@ virVMXParseParallel(virVMXContext *ctx, virConfPtr conf, int port,
goto cleanup;
}
} else {
- VMX_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("Expecting VMX entry '%s' to be 'device' or
'file' but "
- "found '%s'"), fileType_name, fileType);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Expecting VMX entry '%s' to be 'device' or
'file' but "
+ "found '%s'"), fileType_name, fileType);
goto cleanup;
}
@@ -2832,7 +2828,7 @@ virVMXParseSVGA(virConfPtr conf, virDomainVideoDefPtr *def)
long long svga_vramSize = 0;
if (def == NULL || *def != NULL) {
- VMX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid
argument"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid
argument"));
return -1;
}
@@ -2886,18 +2882,18 @@ virVMXFormatConfig(virVMXContext *ctx, virCapsPtr caps,
virDomainDefPtr def,
bool floppy_present[2] = { false, false };
if (ctx->formatFileName == NULL) {
- VMX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
- _("virVMXContext has no formatFileName function set"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("virVMXContext has no formatFileName function set"));
return NULL;
}
memset(zero, 0, VIR_UUID_BUFLEN);
if (def->virtType != VIR_DOMAIN_VIRT_VMWARE) {
- VMX_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("Expecting virt type to be '%s' but found
'%s'"),
- virDomainVirtTypeToString(VIR_DOMAIN_VIRT_VMWARE),
- virDomainVirtTypeToString(def->virtType));
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Expecting virt type to be '%s' but found
'%s'"),
+ virDomainVirtTypeToString(VIR_DOMAIN_VIRT_VMWARE),
+ virDomainVirtTypeToString(def->virtType));
return NULL;
}
@@ -2917,9 +2913,9 @@ virVMXFormatConfig(virVMXContext *ctx, virCapsPtr caps,
virDomainDefPtr def,
} else if (STRCASEEQ(def->os.arch, "x86_64")) {
virBufferAddLit(&buffer, "guestOS = \"other-64\"\n");
} else {
- VMX_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("Expecting domain XML attribute 'arch' of entry
'os/type' "
- "to be 'i686' or 'x86_64' but found
'%s'"), def->os.arch);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Expecting domain XML attribute 'arch' of entry
'os/type' "
+ "to be 'i686' or 'x86_64' but found
'%s'"), def->os.arch);
goto cleanup;
}
@@ -2930,9 +2926,9 @@ virVMXFormatConfig(virVMXContext *ctx, virCapsPtr caps,
virDomainDefPtr def,
} else if (def->os.smbios_mode == VIR_DOMAIN_SMBIOS_HOST) {
virBufferAddLit(&buffer, "smbios.reflecthost =
\"true\"\n");
} else {
- VMX_ERROR(VIR_ERR_CONFIG_UNSUPPORTED,
- _("Unsupported SMBIOS mode '%s'"),
- virDomainSmbiosModeTypeToString(def->os.smbios_mode));
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("Unsupported SMBIOS mode '%s'"),
+ virDomainSmbiosModeTypeToString(def->os.smbios_mode));
goto cleanup;
}
@@ -2994,16 +2990,16 @@ virVMXFormatConfig(virVMXContext *ctx, virCapsPtr caps,
virDomainDefPtr def,
/* def:maxvcpus -> vmx:numvcpus */
if (def->vcpus != def->maxvcpus) {
- VMX_ERROR(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
- _("No support for domain XML entry 'vcpu' attribute
"
- "'current'"));
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("No support for domain XML entry 'vcpu' attribute
"
+ "'current'"));
goto cleanup;
}
if (def->maxvcpus <= 0 || (def->maxvcpus % 2 != 0 &&
def->maxvcpus != 1)) {
- VMX_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("Expecting domain XML entry 'vcpu' to be an unsigned
"
- "integer (1 or a multiple of 2) but found %d"),
- def->maxvcpus);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Expecting domain XML entry 'vcpu' to be an
unsigned "
+ "integer (1 or a multiple of 2) but found %d"),
+ def->maxvcpus);
goto cleanup;
}
@@ -3022,10 +3018,10 @@ virVMXFormatConfig(virVMXContext *ctx, virCapsPtr caps,
virDomainDefPtr def,
}
if (sched_cpu_affinity_length < def->maxvcpus) {
- VMX_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("Expecting domain XML attribute 'cpuset' of entry
"
- "'vcpu' to contain at least %d CPU(s)"),
- def->maxvcpus);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Expecting domain XML attribute 'cpuset' of
entry "
+ "'vcpu' to contain at least %d CPU(s)"),
+ def->maxvcpus);
goto cleanup;
}
@@ -3070,9 +3066,9 @@ virVMXFormatConfig(virVMXContext *ctx, virCapsPtr caps,
virDomainDefPtr def,
break;
default:
- VMX_ERROR(VIR_ERR_CONFIG_UNSUPPORTED,
- _("Unsupported graphics type '%s'"),
- virDomainGraphicsTypeToString(def->graphics[i]->type));
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("Unsupported graphics type '%s'"),
+ virDomainGraphicsTypeToString(def->graphics[i]->type));
goto cleanup;
}
}
@@ -3127,9 +3123,9 @@ virVMXFormatConfig(virVMXContext *ctx, virCapsPtr caps,
virDomainDefPtr def,
break;
default:
- VMX_ERROR(VIR_ERR_CONFIG_UNSUPPORTED,
- _("Unsupported disk device type '%s'"),
- virDomainDiskDeviceTypeToString(def->disks[i]->device));
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("Unsupported disk device type '%s'"),
+
virDomainDiskDeviceTypeToString(def->disks[i]->device));
goto cleanup;
}
}
@@ -3160,8 +3156,8 @@ virVMXFormatConfig(virVMXContext *ctx, virCapsPtr caps,
virDomainDefPtr def,
/* def:videos */
if (def->nvideos > 0) {
if (def->nvideos > 1) {
- VMX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
- _("No support for multiple video devices"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("No support for multiple video devices"));
goto cleanup;
}
@@ -3215,7 +3211,7 @@ virVMXFormatVNC(virDomainGraphicsDefPtr def, virBufferPtr buffer)
const char *listenAddr;
if (def->type != VIR_DOMAIN_GRAPHICS_TYPE_VNC) {
- VMX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid
argument"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid
argument"));
return -1;
}
@@ -3265,7 +3261,7 @@ virVMXFormatHardDisk(virVMXContext *ctx, virDomainDiskDefPtr def,
char *fileName = NULL;
if (def->device != VIR_DOMAIN_DISK_DEVICE_DISK) {
- VMX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid
argument"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid
argument"));
return -1;
}
@@ -3288,17 +3284,17 @@ virVMXFormatHardDisk(virVMXContext *ctx, virDomainDiskDefPtr def,
return -1;
}
} else {
- VMX_ERROR(VIR_ERR_CONFIG_UNSUPPORTED,
- _("Unsupported bus type '%s' for harddisk"),
- virDomainDiskBusTypeToString(def->bus));
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("Unsupported bus type '%s' for harddisk"),
+ virDomainDiskBusTypeToString(def->bus));
return -1;
}
if (def->type != VIR_DOMAIN_DISK_TYPE_FILE) {
- VMX_ERROR(VIR_ERR_CONFIG_UNSUPPORTED,
- _("%s harddisk '%s' has unsupported type '%s',
expecting '%s'"),
- busName, def->dst, virDomainDiskTypeToString(def->type),
- virDomainDiskTypeToString(VIR_DOMAIN_DISK_TYPE_FILE));
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("%s harddisk '%s' has unsupported type
'%s', expecting '%s'"),
+ busName, def->dst, virDomainDiskTypeToString(def->type),
+ virDomainDiskTypeToString(VIR_DOMAIN_DISK_TYPE_FILE));
return -1;
}
@@ -3309,9 +3305,9 @@ virVMXFormatHardDisk(virVMXContext *ctx, virDomainDiskDefPtr def,
if (def->src != NULL) {
if (! virFileHasSuffix(def->src, ".vmdk")) {
- VMX_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("Image file for %s harddisk '%s' has unsupported
suffix, "
- "expecting '.vmdk'"), busName, def->dst);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Image file for %s harddisk '%s' has
unsupported suffix, "
+ "expecting '.vmdk'"), busName,
def->dst);
return -1;
}
@@ -3332,10 +3328,10 @@ virVMXFormatHardDisk(virVMXContext *ctx, virDomainDiskDefPtr def,
virBufferAsprintf(buffer, "%s%d:%d.writeThrough =
\"true\"\n",
entryPrefix, controllerOrBus, unit);
} else if (def->cachemode != VIR_DOMAIN_DISK_CACHE_DEFAULT) {
- VMX_ERROR(VIR_ERR_CONFIG_UNSUPPORTED,
- _("%s harddisk '%s' has unsupported cache mode
'%s'"),
- busName, def->dst,
- virDomainDiskCacheTypeToString(def->cachemode));
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("%s harddisk '%s' has unsupported cache mode
'%s'"),
+ busName, def->dst,
+ virDomainDiskCacheTypeToString(def->cachemode));
return -1;
}
}
@@ -3355,7 +3351,7 @@ virVMXFormatCDROM(virVMXContext *ctx, virDomainDiskDefPtr def,
char *fileName = NULL;
if (def->device != VIR_DOMAIN_DISK_DEVICE_CDROM) {
- VMX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid
argument"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid
argument"));
return -1;
}
@@ -3376,9 +3372,9 @@ virVMXFormatCDROM(virVMXContext *ctx, virDomainDiskDefPtr def,
return -1;
}
} else {
- VMX_ERROR(VIR_ERR_CONFIG_UNSUPPORTED,
- _("Unsupported bus type '%s' for cdrom"),
- virDomainDiskBusTypeToString(def->bus));
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("Unsupported bus type '%s' for cdrom"),
+ virDomainDiskBusTypeToString(def->bus));
return -1;
}
@@ -3391,9 +3387,9 @@ virVMXFormatCDROM(virVMXContext *ctx, virDomainDiskDefPtr def,
if (def->src != NULL) {
if (! virFileHasSuffix(def->src, ".iso")) {
- VMX_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("Image file for %s cdrom '%s' has unsupported
"
- "suffix, expecting '.iso'"), busName,
def->dst);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Image file for %s cdrom '%s' has
unsupported "
+ "suffix, expecting '.iso'"), busName,
def->dst);
return -1;
}
@@ -3417,12 +3413,12 @@ virVMXFormatCDROM(virVMXContext *ctx, virDomainDiskDefPtr def,
entryPrefix, controllerOrBus, unit, def->src);
}
} else {
- VMX_ERROR(VIR_ERR_CONFIG_UNSUPPORTED,
- _("%s cdrom '%s' has unsupported type '%s',
expecting '%s' "
- "or '%s'"), busName, def->dst,
- virDomainDiskTypeToString(def->type),
- virDomainDiskTypeToString(VIR_DOMAIN_DISK_TYPE_FILE),
- virDomainDiskTypeToString(VIR_DOMAIN_DISK_TYPE_BLOCK));
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("%s cdrom '%s' has unsupported type '%s',
expecting '%s' "
+ "or '%s'"), busName, def->dst,
+ virDomainDiskTypeToString(def->type),
+ virDomainDiskTypeToString(VIR_DOMAIN_DISK_TYPE_FILE),
+ virDomainDiskTypeToString(VIR_DOMAIN_DISK_TYPE_BLOCK));
return -1;
}
@@ -3439,7 +3435,7 @@ virVMXFormatFloppy(virVMXContext *ctx, virDomainDiskDefPtr def,
char *fileName = NULL;
if (def->device != VIR_DOMAIN_DISK_DEVICE_FLOPPY) {
- VMX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid
argument"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid
argument"));
return -1;
}
@@ -3456,9 +3452,9 @@ virVMXFormatFloppy(virVMXContext *ctx, virDomainDiskDefPtr def,
if (def->src != NULL) {
if (! virFileHasSuffix(def->src, ".flp")) {
- VMX_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("Image file for floppy '%s' has unsupported
"
- "suffix, expecting '.flp'"), def->dst);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Image file for floppy '%s' has unsupported
"
+ "suffix, expecting '.flp'"),
def->dst);
return -1;
}
@@ -3481,12 +3477,12 @@ virVMXFormatFloppy(virVMXContext *ctx, virDomainDiskDefPtr def,
unit, def->src);
}
} else {
- VMX_ERROR(VIR_ERR_CONFIG_UNSUPPORTED,
- _("Floppy '%s' has unsupported type '%s',
expecting '%s' "
- "or '%s'"), def->dst,
- virDomainDiskTypeToString(def->type),
- virDomainDiskTypeToString(VIR_DOMAIN_DISK_TYPE_FILE),
- virDomainDiskTypeToString(VIR_DOMAIN_DISK_TYPE_BLOCK));
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("Floppy '%s' has unsupported type '%s',
expecting '%s' "
+ "or '%s'"), def->dst,
+ virDomainDiskTypeToString(def->type),
+ virDomainDiskTypeToString(VIR_DOMAIN_DISK_TYPE_FILE),
+ virDomainDiskTypeToString(VIR_DOMAIN_DISK_TYPE_BLOCK));
return -1;
}
@@ -3503,9 +3499,9 @@ virVMXFormatEthernet(virDomainNetDefPtr def, int controller,
unsigned int prefix, suffix;
if (controller < 0 || controller > 3) {
- VMX_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("Ethernet controller index %d out of [0..3] range"),
- controller);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Ethernet controller index %d out of [0..3] range"),
+ controller);
return -1;
}
@@ -3518,10 +3514,10 @@ virVMXFormatEthernet(virDomainNetDefPtr def, int controller,
STRCASENEQ(def->model, "vmxnet2") &&
STRCASENEQ(def->model, "vmxnet3") &&
STRCASENEQ(def->model, "e1000")) {
- VMX_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("Expecting domain XML entry
'devices/interface/model' "
- "to be 'vlance' or 'vmxnet' or
'vmxnet2' or 'vmxnet3' "
- "or 'e1000' but found '%s'"),
def->model);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Expecting domain XML entry
'devices/interface/model' "
+ "to be 'vlance' or 'vmxnet' or
'vmxnet2' or 'vmxnet3' "
+ "or 'e1000' but found '%s'"),
def->model);
return -1;
}
@@ -3561,8 +3557,8 @@ virVMXFormatEthernet(virDomainNetDefPtr def, int controller,
break;
default:
- VMX_ERROR(VIR_ERR_CONFIG_UNSUPPORTED, _("Unsupported net type
'%s'"),
- virDomainNetTypeToString(def->type));
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("Unsupported net type
'%s'"),
+ virDomainNetTypeToString(def->type));
return -1;
}
@@ -3611,9 +3607,9 @@ virVMXFormatSerial(virVMXContext *ctx, virDomainChrDefPtr def,
const char *protocol;
if (def->target.port < 0 || def->target.port > 3) {
- VMX_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("Serial port index %d out of [0..3] range"),
- def->target.port);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Serial port index %d out of [0..3] range"),
+ def->target.port);
return -1;
}
@@ -3676,9 +3672,9 @@ virVMXFormatSerial(virVMXContext *ctx, virDomainChrDefPtr def,
break;
default:
- VMX_ERROR(VIR_ERR_CONFIG_UNSUPPORTED,
- _("Unsupported character device TCP protocol
'%s'"),
- virDomainChrTcpProtocolTypeToString(
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("Unsupported character device TCP protocol
'%s'"),
+ virDomainChrTcpProtocolTypeToString(
def->source.data.tcp.protocol));
return -1;
}
@@ -3694,9 +3690,9 @@ virVMXFormatSerial(virVMXContext *ctx, virDomainChrDefPtr def,
break;
default:
- VMX_ERROR(VIR_ERR_CONFIG_UNSUPPORTED,
- _("Unsupported character device type '%s'"),
- virDomainChrTypeToString(def->source.type));
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("Unsupported character device type '%s'"),
+ virDomainChrTypeToString(def->source.type));
return -1;
}
@@ -3717,9 +3713,9 @@ virVMXFormatParallel(virVMXContext *ctx, virDomainChrDefPtr def,
char *fileName = NULL;
if (def->target.port < 0 || def->target.port > 2) {
- VMX_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("Parallel port index %d out of [0..2] range"),
- def->target.port);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Parallel port index %d out of [0..2] range"),
+ def->target.port);
return -1;
}
@@ -3752,9 +3748,9 @@ virVMXFormatParallel(virVMXContext *ctx, virDomainChrDefPtr def,
break;
default:
- VMX_ERROR(VIR_ERR_CONFIG_UNSUPPORTED,
- _("Unsupported character device type '%s'"),
- virDomainChrTypeToString(def->source.type));
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("Unsupported character device type '%s'"),
+ virDomainChrTypeToString(def->source.type));
return -1;
}
@@ -3769,9 +3765,9 @@ virVMXFormatSVGA(virDomainVideoDefPtr def, virBufferPtr buffer)
unsigned long long vram;
if (def->type != VIR_DOMAIN_VIDEO_TYPE_VMVGA) {
- VMX_ERROR(VIR_ERR_CONFIG_UNSUPPORTED,
- _("Unsupported video device type '%s'"),
- virDomainVideoTypeToString(def->type));
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("Unsupported video device type '%s'"),
+ virDomainVideoTypeToString(def->type));
return -1;
}
@@ -3782,8 +3778,8 @@ virVMXFormatSVGA(virDomainVideoDefPtr def, virBufferPtr buffer)
vram = VIR_DIV_UP(def->vram, 64) * 64;
if (def->heads > 1) {
- VMX_ERROR(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
- _("Multi-head video devices are unsupported"));
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("Multi-head video devices are unsupported"));
return -1;
}
--
1.7.10.4