aboutsummaryrefslogtreecommitdiff
path: root/vl.c
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2009-08-14 10:34:22 +0200
committerAnthony Liguori <aliguori@us.ibm.com>2009-08-27 20:46:58 -0500
commit382f074371f7dc32a34c944c845b1698e83d8c36 (patch)
treef05fad2d2e592ad2eaa2fa0fd58eb64e86eea7a4 /vl.c
parent59f2a78793b6d17634f39646d604e84af51e0919 (diff)
switch balloon initialization to -device.
With that patch applied "-balloon virtio,args" becomes a shortcut for "-device virtio-balloon-pci,args". Side effects: - ballon device gains support for id=<tag>. - ballon device is off by default now. - initialization order changes, which may in different pci slot assignment depending on the VM configuration. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'vl.c')
-rw-r--r--vl.c34
1 files changed, 18 insertions, 16 deletions
diff --git a/vl.c b/vl.c
index cd0f907b31..a89428573b 100644
--- a/vl.c
+++ b/vl.c
@@ -222,8 +222,6 @@ int smp_threads = 1;
const char *vnc_display;
int acpi_enabled = 1;
int no_hpet = 0;
-int virtio_balloon = 1;
-const char *virtio_balloon_devaddr;
int fd_bootchk = 1;
int no_reboot = 0;
int no_shutdown = 0;
@@ -4586,23 +4584,27 @@ static void select_vgahw (const char *p)
#ifdef TARGET_I386
static int balloon_parse(const char *arg)
{
- char buf[128];
- const char *p;
+ QemuOpts *opts;
- if (!strcmp(arg, "none")) {
- virtio_balloon = 0;
- } else if (!strncmp(arg, "virtio", 6)) {
- virtio_balloon = 1;
- if (arg[6] == ',') {
- p = arg + 7;
- if (get_param_value(buf, sizeof(buf), "addr", p)) {
- virtio_balloon_devaddr = strdup(buf);
- }
+ if (strcmp(arg, "none") == 0) {
+ return 0;
+ }
+
+ if (!strncmp(arg, "virtio", 6)) {
+ if (arg[6] == ',') {
+ /* have params -> parse them */
+ opts = qemu_opts_parse(&qemu_device_opts, arg+7, NULL);
+ if (!opts)
+ return -1;
+ } else {
+ /* create empty opts */
+ opts = qemu_opts_create(&qemu_device_opts, NULL, 0);
}
- } else {
- return -1;
+ qemu_opt_set(opts, "driver", "virtio-balloon-pci");
+ return 0;
}
- return 0;
+
+ return -1;
}
#endif