From c531ce9e068ad2ab07df90bd69cc379b7a7de986 Mon Sep 17 00:00:00 2001
Message-Id: <c531ce9e068ad2ab07df90bd69cc379b7a7de986.1350567686.git.minovotn@redhat.com>
In-Reply-To: <e8d21dedbb11e84476f54f7285e4758556f1395f.1350567686.git.minovotn@redhat.com>
References: <e8d21dedbb11e84476f54f7285e4758556f1395f.1350567686.git.minovotn@redhat.com>
From: Jason Baron <jbaron@redhat.com>
Date: Fri, 12 Oct 2012 19:44:30 +0200
Subject: [PATCH 3/7] Allow to leave type on default in -machine

RH-Author: Jason Baron <jbaron@redhat.com>
Message-id: <a175d00446025b5d3c28a624a396dce765199978.1350069767.git.jbaron@redhat.com>
Patchwork-id: 43069
O-Subject: [RHEL 6.4 qemu-kvm PATCH v4 3/7] Allow to leave type on default in -machine
Bugzilla: 859447
RH-Acked-by: Markus Armbruster <armbru@redhat.com>
RH-Acked-by: Pavel Hrdina <phrdina@redhat.com>
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>

From: Jan Kiszka <jan.kiszka@siemens.com>

This allows to specify -machine options without setting an explicit
machine type. We will pick the default machine in this case. Requesting
the list of available machines is still possible via '-machine ?' e.g.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
(cherry picked from commit 2645c6dcaf6ea2a51a3b6dfa407dd203004e4d11)

Signed-off-by: Jason Baron <jbaron@redhat.com>
---
 vl.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

Signed-off-by: Michal Novotny <minovotn@redhat.com>
---
 vl.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/vl.c b/vl.c
index 77afed0..f349db9 100644
--- a/vl.c
+++ b/vl.c
@@ -5774,7 +5774,10 @@ int main(int argc, char **argv, char **envp)
                     fprintf(stderr, "parse error: %s\n", optarg);
                     exit(1);
                 }
-                machine = machine_parse(qemu_opt_get(opts, "type"));
+                optarg = qemu_opt_get(opts, "type");
+                if (optarg) {
+                    machine = machine_parse(optarg);
+                }
                 break;
             case QEMU_OPTION_usb:
                 usb_enabled = 1;
-- 
1.7.11.7

