Re: [PATCH] make virDomainGetMaxVcpus work on inactive domains

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



At Mon, 24 Feb 2014 15:18:21 +0100,
Michal Privoznik wrote:
> 
> On 19.02.2014 13:03, Claudio Bley wrote:
> >
> > Signed-off-by: Claudio Bley <cbley@xxxxxxxxxx>
> > ---
> > OK, how about this patch?
> >
> > While at it, should I convert the VIR_DOMAIN_VCPU_* instances to
> > VIR_DOMAIN_AFFECT_* instances for consistency?
> >
> >   src/esx/esx_driver.c       |    2 +-
> >   src/openvz/openvz_driver.c |    2 +-
> >   src/phyp/phyp_driver.c     |    2 +-
> >   src/qemu/qemu_driver.c     |    2 +-
> >   src/test/test_driver.c     |    2 +-
> >   src/vbox/vbox_tmpl.c       |    2 +-
> >   src/xen/xen_driver.c       |    2 +-
> >   src/xenapi/xenapi_driver.c |    2 +-
> >   8 files changed, 8 insertions(+), 8 deletions(-)
> >
> > diff --git a/src/esx/esx_driver.c b/src/esx/esx_driver.c
> > index 886d984..6e05d78 100644
> > --- a/src/esx/esx_driver.c
> > +++ b/src/esx/esx_driver.c
> > @@ -2646,7 +2646,7 @@ esxDomainGetVcpusFlags(virDomainPtr domain, unsigned int flags)
> >   static int
> >   esxDomainGetMaxVcpus(virDomainPtr domain)
> >   {
> > -    return esxDomainGetVcpusFlags(domain, (VIR_DOMAIN_AFFECT_LIVE |
> > +    return esxDomainGetVcpusFlags(domain, (VIR_DOMAIN_AFFECT_CURRENT |
> >                                              VIR_DOMAIN_VCPU_MAXIMUM));
> >   }
> 
> This won't work esxDomainGetVcpusFlags() requires flags to be exactly
> (VIR_DOMAIN_AFFECT_LIVE | VIR_DOMAIN_VCPU_MAXIMUM).

Would it be OK to change the function like this, until the
esxDomainGetVcpusFlags function is fixed?

----------------------------------------------------------------------
static int
esxDomainGetMaxVcpus(virDomainPtr domain)
{
    switch (esxDomainIsActive(domain)) {
    case 0:
        virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, "%s",
                       _("esxDomainGetMaxVcpus is not supported for inactive domains"));
    case -1:
        return -1;

    default:
        return esxDomainGetVcpusFlags(domain, (VIR_DOMAIN_AFFECT_LIVE |
                                               VIR_DOMAIN_VCPU_MAXIMUM));
    }
}
----------------------------------------------------------------------

Likewise for the other broken drivers...

Claudio

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]