maint: Clean up coding style and fix error message spelling

This patch cleans up coding style breaks some long lines and fixes error
message spelling on various places in domain_conf.c and in the qemu
driver.
This commit is contained in:
Peter Krempa 2012-07-02 17:24:09 +02:00
parent d57e17d583
commit 8e0f7faf56
3 changed files with 26 additions and 22 deletions

View File

@ -8609,11 +8609,12 @@ static virDomainDefPtr virDomainDefParseXML(virCapsPtr caps,
} }
/* analysis of the disk devices */ /* analysis of the disk devices */
if ((n = virXPathNodeSet("./devices/disk", ctxt, &nodes)) < 0) { if ((n = virXPathNodeSet("./devices/disk", ctxt, &nodes)) < 0)
goto error; goto error;
}
if (n && VIR_ALLOC_N(def->disks, n) < 0) if (n && VIR_ALLOC_N(def->disks, n) < 0)
goto no_memory; goto no_memory;
for (i = 0 ; i < n ; i++) { for (i = 0 ; i < n ; i++) {
virDomainDiskDefPtr disk = virDomainDiskDefParseXML(caps, virDomainDiskDefPtr disk = virDomainDiskDefParseXML(caps,
nodes[i], nodes[i],
@ -8629,11 +8630,12 @@ static virDomainDefPtr virDomainDefParseXML(virCapsPtr caps,
VIR_FREE(nodes); VIR_FREE(nodes);
/* analysis of the controller devices */ /* analysis of the controller devices */
if ((n = virXPathNodeSet("./devices/controller", ctxt, &nodes)) < 0) { if ((n = virXPathNodeSet("./devices/controller", ctxt, &nodes)) < 0)
goto error; goto error;
}
if (n && VIR_ALLOC_N(def->controllers, n) < 0) if (n && VIR_ALLOC_N(def->controllers, n) < 0)
goto no_memory; goto no_memory;
for (i = 0 ; i < n ; i++) { for (i = 0 ; i < n ; i++) {
virDomainControllerDefPtr controller = virDomainControllerDefParseXML(nodes[i], virDomainControllerDefPtr controller = virDomainControllerDefParseXML(nodes[i],
flags); flags);
@ -8755,9 +8757,9 @@ static virDomainDefPtr virDomainDefParseXML(virCapsPtr caps,
} }
VIR_FREE(nodes); VIR_FREE(nodes);
if ((n = virXPathNodeSet("./devices/serial", ctxt, &nodes)) < 0) { if ((n = virXPathNodeSet("./devices/serial", ctxt, &nodes)) < 0)
goto error; goto error;
}
if (n && VIR_ALLOC_N(def->serials, n) < 0) if (n && VIR_ALLOC_N(def->serials, n) < 0)
goto no_memory; goto no_memory;
@ -9051,8 +9053,8 @@ static virDomainDefPtr virDomainDefParseXML(virCapsPtr caps,
goto error; goto error;
} }
if (n > 1) { if (n > 1) {
virReportError (VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
"%s", _("only a single watchdog device is supported")); _("only a single watchdog device is supported"));
goto error; goto error;
} }
if (n > 0) { if (n > 0) {
@ -9071,8 +9073,8 @@ static virDomainDefPtr virDomainDefParseXML(virCapsPtr caps,
goto error; goto error;
} }
if (n > 1) { if (n > 1) {
virReportError (VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
"%s", _("only a single memory balloon device is supported")); _("only a single memory balloon device is supported"));
goto error; goto error;
} }
if (n > 0) { if (n > 0) {

View File

@ -4789,25 +4789,28 @@ qemuBuildCommandLine(virConnectPtr conn,
/* Only recent QEMU implements a SATA (AHCI) controller */ /* Only recent QEMU implements a SATA (AHCI) controller */
if (cont->type == VIR_DOMAIN_CONTROLLER_TYPE_SATA) { if (cont->type == VIR_DOMAIN_CONTROLLER_TYPE_SATA) {
if (!qemuCapsGet(qemuCaps, QEMU_CAPS_ICH9_AHCI)) { if (!qemuCapsGet(qemuCaps, QEMU_CAPS_ICH9_AHCI)) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
"%s", _("SATA is not supported with this QEMU binary")); _("SATA is not supported with this "
"QEMU binary"));
goto error; goto error;
} else { } else {
char *devstr; char *devstr;
virCommandAddArg(cmd, "-device"); virCommandAddArg(cmd, "-device");
if (!(devstr = qemuBuildControllerDevStr(def, cont, qemuCaps, NULL))) if (!(devstr = qemuBuildControllerDevStr(def, cont,
qemuCaps, NULL)))
goto error; goto error;
virCommandAddArg(cmd, devstr); virCommandAddArg(cmd, devstr);
VIR_FREE(devstr); VIR_FREE(devstr);
} }
} else if (def->controllers[i]->type == VIR_DOMAIN_CONTROLLER_TYPE_USB && } else if (cont->type == VIR_DOMAIN_CONTROLLER_TYPE_USB &&
def->controllers[i]->model == -1 && cont->model == -1 &&
!qemuCapsGet(qemuCaps, QEMU_CAPS_PIIX3_USB_UHCI)) { !qemuCapsGet(qemuCaps, QEMU_CAPS_PIIX3_USB_UHCI)) {
if (usblegacy) { if (usblegacy) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("Multiple legacy USB controller not supported")); _("Multiple legacy USB controllers are "
"not supported"));
goto error; goto error;
} }
usblegacy = true; usblegacy = true;
@ -4815,7 +4818,7 @@ qemuBuildCommandLine(virConnectPtr conn,
virCommandAddArg(cmd, "-device"); virCommandAddArg(cmd, "-device");
char *devstr; char *devstr;
if (!(devstr = qemuBuildControllerDevStr(def, def->controllers[i], qemuCaps, if (!(devstr = qemuBuildControllerDevStr(def, cont, qemuCaps,
&usbcontroller))) &usbcontroller)))
goto error; goto error;

View File

@ -5803,8 +5803,7 @@ qemuDomainModifyDeviceFlags(virDomainPtr dom, const char *xml,
flags |= VIR_DOMAIN_AFFECT_CONFIG; flags |= VIR_DOMAIN_AFFECT_CONFIG;
/* check consistency between flags and the vm state */ /* check consistency between flags and the vm state */
if (flags & VIR_DOMAIN_AFFECT_LIVE) { if (flags & VIR_DOMAIN_AFFECT_LIVE) {
virReportError(VIR_ERR_OPERATION_INVALID, virReportError(VIR_ERR_OPERATION_INVALID, "%s",
"%s",
_("cannot do live update a device on " _("cannot do live update a device on "
"inactive domain")); "inactive domain"));
goto endjob; goto endjob;
@ -5812,8 +5811,8 @@ qemuDomainModifyDeviceFlags(virDomainPtr dom, const char *xml,
} }
if ((flags & VIR_DOMAIN_AFFECT_CONFIG) && !vm->persistent) { if ((flags & VIR_DOMAIN_AFFECT_CONFIG) && !vm->persistent) {
virReportError(VIR_ERR_OPERATION_INVALID, virReportError(VIR_ERR_OPERATION_INVALID, "%s",
"%s", _("cannot modify device on transient domain")); _("cannot modify device on transient domain"));
goto endjob; goto endjob;
} }