On Thu, May 14, 2015 at 03:36:28PM -0400, Laine Stump wrote:
Reorganize the loop that builds controller args to remove
unnecessary
duplicated code and superfluous else clauses. No functional change
(this was split out from the following patch to make review easier).
This note can be dropped from git history.
---
New in V2 - this was a part of patch 11/13 in V1. jtomko requested
that I separate out the cleanup from the bugfix, so this is the
cleanup of existing code, and the bugfix will be in the next patch.
Thanks, it's much easier to follow now.
src/qemu/qemu_command.c | 81 ++++++++++++++++++++++++-------------------------
1 file changed, 39 insertions(+), 42 deletions(-)
- /* Only recent QEMU implements a SATA (AHCI) controller */
- if (cont->type == VIR_DOMAIN_CONTROLLER_TYPE_SATA) {
- if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_ICH9_AHCI)) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
- _("SATA is not supported with this "
- "QEMU binary"));
- goto error;
- } else if (cont->idx == 0 && qemuDomainMachineIsQ35(def))
{
- /* first SATA controller on Q35 machines is implicit */
+ /* first SATA controller on Q35 machines is implicit */
+ if (cont->type == VIR_DOMAIN_CONTROLLER_TYPE_SATA &&
+ cont->idx == 0 && qemuDomainMachineIsQ35(def))
continue;
Unless intended, this is indented one level too many.
- } else {
- char *devstr;
-
- virCommandAddArg(cmd, "-device");
- if (!(devstr = qemuBuildControllerDevStr(def, cont,
- qemuCaps, NULL)))
- goto error;
- virCommandAddArg(cmd, devstr);
- VIR_FREE(devstr);
- }
Jan