[Libguestfs] [PATCH 1/3] launch: libvirt: Move the is_kvm flag (derived from libvirt capabilities) to backend data struct.

Richard W.M. Jones rjones at redhat.com
Mon Mar 10 18:02:15 UTC 2014


On Mon, Mar 10, 2014 at 06:59:23PM +0100, Pino Toscano wrote:
> Hi,
> 
> On Monday 10 March 2014 17:28:52 Richard W.M. Jones wrote:
> > diff --git a/src/launch-libvirt.c b/src/launch-libvirt.c
> > index fd6e6d2..d86e2d2 100644
> > --- a/src/launch-libvirt.c
> > +++ b/src/launch-libvirt.c
> > @@ -106,6 +106,7 @@ struct backend_libvirt_data {
> >    char *selinux_imagelabel;
> >    bool selinux_norelabel_disks;
> >    char name[DOMAIN_NAME_LEN];   /* random name */
> > +  bool is_kvm;                  /* false = qemu, true = kvm (from capabilities)*/ };
> > 
> >  /* Parameters passed to construct_libvirt_xml and subfunctions.  We
> > @@ -122,12 +123,11 @@ struct libvirt_xml_params {
> >    char guestfsd_path[UNIX_PATH_MAX]; /* paths to sockets */
> >    char console_path[UNIX_PATH_MAX];
> >    bool enable_svirt;            /* false if we decided to disable sVirt */
> > -  bool is_kvm;                  /* false = qemu, true = kvm */
> >    bool current_proc_is_root;    /* true = euid is root */
> >  };
> > 
> > -static int parse_capabilities (guestfs_h *g, const char *capabilities_xml, struct libvirt_xml_params *params);
> > -static xmlChar *construct_libvirt_xml (guestfs_h *g, const struct libvirt_xml_params *params);
> > +static int parse_capabilities (guestfs_h *g, const char *capabilities_xml, struct backend_libvirt_data *data);
> > +static xmlChar *construct_libvirt_xml (guestfs_h *g, const struct backend_libvirt_data *data, const struct libvirt_xml_params *params);
> 
> Considering the libvirt_xml_params struct has already a
> 'struct backend_libvirt_data *data' member, I guess these (and the
> others) functions could just access params->data->is_kvm with no need
> to pass also backend_libvirt_data around, no?
> After all, construct_libvirt_xml_name does this already.

Good point, will fix.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
libguestfs lets you edit virtual machines.  Supports shell scripting,
bindings from many languages.  http://libguestfs.org




More information about the Libguestfs mailing list