
On Wed, Feb 17, 2016 at 21:25:34 -0500, John Ferlan wrote:
Create qemuBuildCommandLineValidate to make some checks before trying to build the command. This will move some logic from much later to much earlier - we shouldn't be adjusting any data so that shouldn't matter.
Signed-off-by: John Ferlan <jferlan@redhat.com> --- src/qemu/qemu_command.c | 174 ++++++++++++++++++++++++++++-------------------- 1 file changed, 102 insertions(+), 72 deletions(-)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 7c1a457..f68509d 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -6608,6 +6608,98 @@ qemuBuildTPMCommandLine(virDomainDefPtr def, }
+/* + * qemuBuildCommandLineValidate:
These kinds of comments use two stars on the first line of the comment.
+ * + * Prior to taking the plunge and building a long command line only + * to find some configuration option isn't valid, let's do a couple + * of checks and fail early. + * + * Returns 0 on success, returns -1 and messages what the issue is. + */
[...]
@@ -7814,11 +7845,17 @@ qemuBuildCommandLine(virConnectPtr conn, virCommandAddArgBuffer(cmd, &opt); }
+ if (def->nserials) { + for (i = 0; i < def->ngraphics && !havespice; i++) {
Fair enough, but we usually use break from the next condition.
+ if (def->graphics[i]->type == VIR_DOMAIN_GRAPHICS_TYPE_SPICE) + havespice = true; + } + }
ACK