On Mon, Jan 19, 2009 at 10:06:47PM -0500, john cooper wrote:
>There have been two differnet syntaxes supported in QEMU for
caching,
>so we need to detect this and switch between them. Originally there
>was just
>
> cache=on & cache=off (writethrough and no caching)
>
>Now it supports
>
> cache=writeback, cache=writethrough and cache=none|off
>
>So, if we detect the earlier syntax we need to raise an error if
>the user requested writeback (or translate it to 'cache=off' for
>safety sake).
I was trying to address part of this as above. But in general
I don't see how we can force an error in advance of launching
qemu without some information beforehand of whether we're
dealing with an old vs. new syntax qemu. One way to do so is
to test launch "qemu --help" and let it tell us what it accepts.
Bingo :-) We already have this problem for many QEMU arguments are
do exactly that.
If you loook at src/qemu_conf.c, you'll find a nice method called
qemudExtractVersionInfo, which runs 'qemu -help' and checks for
certain interesting command line arguments :-) So in src/qemu_conf.h
just define a new enum value QEMUD_CMD_FLAG_NEW_CACHE and then
check for something in the help output as per existing examples.
Alternatively we can just let qemu error exit in the case an
old/new qemu version doesn't recognize the alternate syntax.
Other than the above I believe I've incorporated all of
your remaining suggestions. Attached is an updated patch.
One note about the enums - rather than adding old style CACHEON
CACHE_OFF options to the main enum in domain_conf, just create
a second enum in the qemu_conf.c file for recording the mapping
of virDomainDiskCache values to old style QEMU arguments values
So in domain_conf.c you'd have
VIR_ENUM_IMPL(virDomainDiskCacheNew, VIR_DOMAIN_DISK_CACHE_LAST,
"default", "off", "writeback",
"writethrough")
While for the legacy qemu syntax can define
VIR_ENUM_DECL(virDomainDiskCacheOld)
VIR_ENUM_IMPL(virDomainDiskCacheOld, VIR_DOMAIN_DISK_CACHE_LAST,
"default", "off", "off", "on")
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 :|