}
/* analysis of the disk devices */
- if ((n = virXPathNodeSet("./devices/disk", ctxt, &nodes)) < 0) {
+ if ((n = virXPathNodeSet("./devices/disk", ctxt, &nodes)) < 0)
goto error;
- }
+
if (n && VIR_ALLOC_N(def->disks, n) < 0)
goto no_memory;
+
for (i = 0 ; i < n ; i++) {
virDomainDiskDefPtr disk = virDomainDiskDefParseXML(caps,
nodes[i],
VIR_FREE(nodes);
/* analysis of the controller devices */
- if ((n = virXPathNodeSet("./devices/controller", ctxt, &nodes)) < 0) {
+ if ((n = virXPathNodeSet("./devices/controller", ctxt, &nodes)) < 0)
goto error;
- }
+
if (n && VIR_ALLOC_N(def->controllers, n) < 0)
goto no_memory;
+
for (i = 0 ; i < n ; i++) {
virDomainControllerDefPtr controller = virDomainControllerDefParseXML(nodes[i],
flags);
}
VIR_FREE(nodes);
- if ((n = virXPathNodeSet("./devices/serial", ctxt, &nodes)) < 0) {
+ if ((n = virXPathNodeSet("./devices/serial", ctxt, &nodes)) < 0)
goto error;
- }
+
if (n && VIR_ALLOC_N(def->serials, n) < 0)
goto no_memory;
goto error;
}
if (n > 1) {
- virReportError (VIR_ERR_INTERNAL_ERROR,
- "%s", _("only a single watchdog device is supported"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("only a single watchdog device is supported"));
goto error;
}
if (n > 0) {
goto error;
}
if (n > 1) {
- virReportError (VIR_ERR_INTERNAL_ERROR,
- "%s", _("only a single memory balloon device is supported"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("only a single memory balloon device is supported"));
goto error;
}
if (n > 0) {
/* Only recent QEMU implements a SATA (AHCI) controller */
if (cont->type == VIR_DOMAIN_CONTROLLER_TYPE_SATA) {
if (!qemuCapsGet(qemuCaps, QEMU_CAPS_ICH9_AHCI)) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
- "%s", _("SATA is not supported with this QEMU binary"));
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("SATA is not supported with this "
+ "QEMU binary"));
goto error;
} else {
char *devstr;
virCommandAddArg(cmd, "-device");
- if (!(devstr = qemuBuildControllerDevStr(def, cont, qemuCaps, NULL)))
+ if (!(devstr = qemuBuildControllerDevStr(def, cont,
+ qemuCaps, NULL)))
goto error;
virCommandAddArg(cmd, devstr);
VIR_FREE(devstr);
}
- } else if (def->controllers[i]->type == VIR_DOMAIN_CONTROLLER_TYPE_USB &&
- def->controllers[i]->model == -1 &&
- !qemuCapsGet(qemuCaps, QEMU_CAPS_PIIX3_USB_UHCI)) {
+ } else if (cont->type == VIR_DOMAIN_CONTROLLER_TYPE_USB &&
+ cont->model == -1 &&
+ !qemuCapsGet(qemuCaps, QEMU_CAPS_PIIX3_USB_UHCI)) {
if (usblegacy) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
- _("Multiple legacy USB controller not supported"));
+ _("Multiple legacy USB controllers are "
+ "not supported"));
goto error;
}
usblegacy = true;
virCommandAddArg(cmd, "-device");
char *devstr;
- if (!(devstr = qemuBuildControllerDevStr(def, def->controllers[i], qemuCaps,
+ if (!(devstr = qemuBuildControllerDevStr(def, cont, qemuCaps,
&usbcontroller)))
goto error;
flags |= VIR_DOMAIN_AFFECT_CONFIG;
/* check consistency between flags and the vm state */
if (flags & VIR_DOMAIN_AFFECT_LIVE) {
- virReportError(VIR_ERR_OPERATION_INVALID,
- "%s",
+ virReportError(VIR_ERR_OPERATION_INVALID, "%s",
_("cannot do live update a device on "
"inactive domain"));
goto endjob;
}
if ((flags & VIR_DOMAIN_AFFECT_CONFIG) && !vm->persistent) {
- virReportError(VIR_ERR_OPERATION_INVALID,
- "%s", _("cannot modify device on transient domain"));
+ virReportError(VIR_ERR_OPERATION_INVALID, "%s",
+ _("cannot modify device on transient domain"));
goto endjob;
}