[libvirt] [PATCH 1/4] qemu: refactor qemuDomainMachineIs* and qemuDomainMachineNeedsFDC

Pavel Hrdina phrdina at redhat.com
Tue Apr 18 09:59:01 UTC 2017


On Tue, Apr 18, 2017 at 11:38:09AM +0200, Peter Krempa wrote:
> On Thu, Apr 13, 2017 at 16:57:13 +0200, Pavel Hrdina wrote:
> > These functions don't require the whole virDomainDef structure,
> > they only need *machine* and *arch*.
> > 
> > Signed-off-by: Pavel Hrdina <phrdina at redhat.com>
> > ---
> >  src/qemu/qemu_alias.c          |  4 +--
> >  src/qemu/qemu_capabilities.c   | 10 +++---
> >  src/qemu/qemu_command.c        | 42 +++++++++++-----------
> >  src/qemu/qemu_domain.c         | 79 ++++++++++++++++++++++--------------------
> >  src/qemu/qemu_domain.h         | 14 ++++----
> >  src/qemu/qemu_domain_address.c | 16 ++++-----
> >  src/qemu/qemu_hotplug.c        | 14 ++++----
> >  src/qemu/qemu_parse_command.c  |  8 ++---
> >  8 files changed, 95 insertions(+), 92 deletions(-)
> 
> In most cases where this is used you have the domain object so it's more
> straightfowrward to extract it from that.
> 
> I'm suggesting that you modify qemuDomainMachineHasBuiltinIDE and
> friends to be a wrapper which only extracts the os.machine object from
> def and calls a new helper which will not take the domain (and not
> contain the word "Domain"). That way you won't have to make all other
> callers uglier.

I had the same idea to create wrapper just for this case and don't mess with
the existing functions.  I agree that having nice helper that will extract
required variables form virDomainDef is convenient.

I'll rework this patch.

Thanks,

Pavel

> --
> libvir-list mailing list
> libvir-list at redhat.com
> https://www.redhat.com/mailman/listinfo/libvir-list

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: Digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20170418/ba282776/attachment-0001.sig>


More information about the libvir-list mailing list