From: Jim Fehlig <jfehlig@suse.com>
To: Michal Privoznik <mprivozn@redhat.com>
Cc: libvir-list@redhat.com, xen-devel@lists.xen.org
Subject: Re: [libvirt] [PATCH 3/5] libxl: Add function to determine device model type
Date: Fri, 10 Oct 2014 15:22:18 -0600 [thread overview]
Message-ID: <54384E0A.6020209@suse.com> (raw)
In-Reply-To: <54324CF3.8050507@redhat.com>
Michal Privoznik wrote:
> On 19.09.2014 21:23, Jim Fehlig wrote:
>> This patch introduces a function to detect whether the specified
>> emulator is QEMU_XEN or QEMU_XEN_TRADITIONAL. Detection is based on the
>> string "Options specific to the Xen version:" in '$qemu -help' output.
>> AFAIK, the only qemu containing that string in help output is the
>> old Xen fork (aka qemu-dm).
>>
>> Note:
>> QEMU_XEN means a qemu that contains support for Xen.
>>
>> QEMU_XEN_TRADITIONAL means Xen's old forked qemu 0.10.2
>>
>> Signed-off-by: Jim Fehlig <jfehlig@suse.com>
>> ---
>> src/libxl/libxl_conf.c | 32 ++++++++++++++++++++++++++++++++
>> src/libxl/libxl_conf.h | 3 +++
>> 2 files changed, 35 insertions(+)
>>
>> diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c
>> index 0a781f9..ff3f6b5 100644
>> --- a/src/libxl/libxl_conf.c
>> +++ b/src/libxl/libxl_conf.c
>> @@ -40,6 +40,7 @@
>> #include "viralloc.h"
>> #include "viruuid.h"
>> #include "capabilities.h"
>> +#include "vircommand.h"
>> #include "libxl_domain.h"
>> #include "libxl_conf.h"
>> #include "libxl_utils.h"
>> @@ -796,6 +797,37 @@ libxlDiskSetDiscard(libxl_device_disk *x_disk,
>> int discard)
>> }
>>
>>
>> +#define LIBXL_QEMU_DM_STR "Options specific to the Xen version:"
>> +
>> +int
>> +libxlDomainGetEmulatorType(const virDomainDef *def)
>> +{
>> + int ret = LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN;
>> + virCommandPtr cmd = NULL;
>> + char *output = NULL;
>> +
>> + if (STREQ(def->os.type, "hvm")) {
>> + if (def->emulator) {
>> + cmd = virCommandNew(def->emulator);
>> +
>> + virCommandAddArgList(cmd, "-help", NULL);
>> + virCommandSetOutputBuffer(cmd, &output);
>> +
>> + if (virCommandRun(cmd, NULL) < 0)
>> + goto cleanup;
>> +
>> + if (strstr(output, LIBXL_QEMU_DM_STR))
>> + ret = LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN_TRADITIONAL;
>> + }
>> + }
>> +
>> + cleanup:
>> + VIR_FREE(output);
>> + virCommandFree(cmd);
>> + return ret;
>> +}
>> +
>> +
>> int
>> libxlMakeDisk(virDomainDiskDefPtr l_disk, libxl_device_disk *x_disk)
>> {
>> diff --git a/src/libxl/libxl_conf.h b/src/libxl/libxl_conf.h
>> index da66b4e..25f77ea 100644
>> --- a/src/libxl/libxl_conf.h
>> +++ b/src/libxl/libxl_conf.h
>> @@ -163,6 +163,9 @@ virCapsPtr
>> libxlMakeCapabilities(libxl_ctx *ctx);
>>
>> int
>> +libxlDomainGetEmulatorType(const virDomainDef *def);
>> +
>> +int
>> libxlMakeDisk(virDomainDiskDefPtr l_dev, libxl_device_disk *x_dev);
>> int
>> libxlMakeNic(virDomainDefPtr def,
>>
>
> Well, we've tried hard to move away from parsing 'qemu -help' output.
Yep, understood.
> But on the other hand, this is trivial compared to virQEMUCaps code
> we've developed.
Right :). This is only detecting if the qemu is Xen's old fork. I
really don't know of any other way to do that.
> So I'd give green flag to this.
Thanks!
Regards,
Jim
next prev parent reply other threads:[~2014-10-10 21:22 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-19 19:23 [PATCH 0/5] libxl: user-specified domain config improvements Jim Fehlig
2014-09-19 19:23 ` [PATCH 1/5] libxl: Copy user-specified keymap to libxl build info struct Jim Fehlig
2014-09-19 19:23 ` [PATCH 2/5] Xen: Defer setting default vram value to Xen drivers Jim Fehlig
2014-10-06 8:04 ` [libvirt] " Michal Privoznik
2014-09-19 19:23 ` [PATCH 3/5] libxl: Add function to determine device model type Jim Fehlig
2014-09-19 19:23 ` [PATCH 4/5] libxl: Implement basic video device selection Jim Fehlig
2014-10-14 8:47 ` [libvirt] " John Ferlan
[not found] ` <543CE32F.8070407@redhat.com>
2014-10-16 19:16 ` Jim Fehlig
2014-09-19 19:23 ` [PATCH 5/5] libxl: Support user-specified <emulator> Jim Fehlig
2014-10-06 8:04 ` [libvirt] " Michal Privoznik
2014-10-06 8:03 ` [libvirt] [PATCH 0/5] libxl: user-specified domain config improvements Michal Privoznik
[not found] ` <1411154594-14871-4-git-send-email-jfehlig@suse.com>
2014-10-06 8:04 ` [libvirt] [PATCH 3/5] libxl: Add function to determine device model type Michal Privoznik
[not found] ` <54324CF3.8050507@redhat.com>
2014-10-10 21:22 ` Jim Fehlig [this message]
[not found] ` <54324CEE.5000505@redhat.com>
2014-10-10 21:23 ` [libvirt] [PATCH 0/5] libxl: user-specified domain config improvements Jim Fehlig
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=54384E0A.6020209@suse.com \
--to=jfehlig@suse.com \
--cc=libvir-list@redhat.com \
--cc=mprivozn@redhat.com \
--cc=xen-devel@lists.xen.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.