On Fri, Jan 08, 2010 at 05:23:15PM +0000, Daniel P. Berrange wrote:
Probe for the new -device flag and if available set the -nodefaults
flag, instead of using -net none, -serial none or -parallel none.
Other device types will be converted to use -device in later patches.
The -nodefaults flag will help avoid unwelcome surprises from future
QEMU releases
* src/qemu/qemu_conf.c: Probe for -device. Add -nodefaults flag.
Remove -net none, -serial none or -parallel none
* src/qemu/qemu_conf.h: Define QEMU_CMD_FLAG_DEVICE
* tests/qemuhelpdata/qemu-0.12.1: New data file for 0.12.1 QEMU
* tests/qemuhelptest.c: Test feature extraction from 0.12.1 QEMU
[...]
@@ -1115,6 +1115,8 @@ static unsigned int qemudComputeCmdFlags(const
char *help,
flags |= QEMUD_CMD_FLAG_CHARDEV;
if (strstr(help, "-balloon"))
flags |= QEMUD_CMD_FLAG_BALLOON;
+ if (strstr(help, "-device"))
+ flags |= QEMUD_CMD_FLAG_DEVICE;
[...]
--- a/src/qemu/qemu_conf.h
+++ b/src/qemu/qemu_conf.h
@@ -78,6 +78,7 @@ enum qemud_cmd_flags {
QEMUD_CMD_FLAG_ENABLE_KVM = (1 << 23), /* Is the -enable-kvm flag available
to "enable KVM full virtualization support" */
QEMUD_CMD_FLAG_MONITOR_JSON = (1 << 24), /* JSON mode for monitor */
QEMUD_CMD_FLAG_BALLOON = (1 << 25), /* -balloon available */
+ QEMUD_CMD_FLAG_DEVICE = (1 << 26), /* Is the new -chardev arg available
*/
};
comment error, it's -device arg, not -chardev which is tested there
--- a/tests/qemuhelptest.c
+++ b/tests/qemuhelptest.c
@@ -21,6 +21,20 @@ struct testInfo {
static char *progname;
static char *abs_srcdir;
+static void printMismatchedFlags(int got, int expect)
+{
+ int i;
+
+ for (i = 0 ; i < (sizeof(got)*8) ; i++) {
+ int gotFlag = (got & (1 << i));
+ int expectFlag = (expect & (1 << i));
+ if (gotFlag && !expectFlag)
+ fprintf(stderr, "Extra flag %i\n", i);
+ if (!gotFlag && expectFlag)
+ fprintf(stderr, "Missing flag %i\n", i);
+ }
+}
+
static int testHelpStrParsing(const void *data)
{
const struct testInfo *info = data;
@@ -40,6 +54,10 @@ static int testHelpStrParsing(const void *data)
if (flags != info->flags) {
fprintf(stderr, "Computed flags do not match: got 0x%x, expected
0x%x\n",
flags, info->flags);
+
+ if (getenv("VIR_TEST_DEBUG"))
+ printMismatchedFlags(flags, info->flags);
+
return -1;
}
Ah, nice improvement !
ACK, but comment need fix
Daniel
--
Daniel Veillard | libxml Gnome XML XSLT toolkit
http://xmlsoft.org/
daniel(a)veillard.com | Rpmfind RPM search engine
http://rpmfind.net/
http://veillard.com/ | virtualization library
http://libvirt.org/