
On Mon, Jul 20, 2009 at 12:51:15PM +0100, Mark McLoughlin wrote:
Add QEMUD_CMD_FLAG_NET_NAME to indicate that '-net ...,name=foo' is supported and QEMUD_CMD_FLAG_HOST_NET_ADD to indicate that the 'host_net_add' monitor command is available.
Set both these flags if the qemu version is greater than 0.10.0. Checking via the '-help' output would not work for the monitor command and even for the command line arg, it would be quite fragile.
* src/qemu_conf.h: add new flags as aliases of QEMUD_CMD_FLAG_0_10
* src/qemu_conf.c: set QEMUD_CMD_FLAG_0_10 for versions >= 0.10.0
* tests/qemuhelptest.c: set QEMUD_CMD_FLAG_0_10 for the appropriate qemu versions --- src/qemu_conf.c | 3 +++ src/qemu_conf.h | 5 +++++ tests/qemuhelptest.c | 9 ++++++--- 3 files changed, 14 insertions(+), 3 deletions(-)
ACK
diff --git a/src/qemu_conf.c b/src/qemu_conf.c index ba99652..a9e5e4e 100644 --- a/src/qemu_conf.c +++ b/src/qemu_conf.c @@ -527,6 +527,9 @@ static unsigned int qemudComputeCmdFlags(const char *help, flags |= QEMUD_CMD_FLAG_MIGRATE_KVM_STDIO; }
+ if (version >= 10000) + flags |= QEMUD_CMD_FLAG_0_10; + return flags; }
diff --git a/src/qemu_conf.h b/src/qemu_conf.h index fbf2ab9..1b2d061 100644 --- a/src/qemu_conf.h +++ b/src/qemu_conf.h @@ -58,6 +58,11 @@ enum qemud_cmd_flags { QEMUD_CMD_FLAG_KVM = (1 << 13), /* Whether KVM is compiled in */ QEMUD_CMD_FLAG_DRIVE_FORMAT = (1 << 14), /* Is -drive format= avail */ QEMUD_CMD_FLAG_VGA = (1 << 15), /* Is -vga avail */ + + /* features added in qemu-0.10.0 */ + QEMUD_CMD_FLAG_0_10 = (1 << 16), + QEMUD_CMD_FLAG_NET_NAME = QEMUD_CMD_FLAG_0_10, /* -net ...,name=str */ + QEMUD_CMD_FLAG_HOST_NET_ADD = QEMUD_CMD_FLAG_0_10, /* host_net_add monitor command */ };
This looks a bit wierd, but then again we're very soon going to rnu out of bits if we keep using up flags, so re-using the flag is OK I reckon. Besides which, this is internal code, so we can change it it we decide we don't like it later. Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|