[libvirt] [PATCH 13/34] conf: Move vcpu count check into helper

Peter Krempa pkrempa at redhat.com
Thu Nov 26 09:54:03 UTC 2015


On Mon, Nov 23, 2015 at 10:35:34 -0500, John Ferlan wrote:
> 
> 
> On 11/20/2015 10:22 AM, Peter Krempa wrote:
> > ---
> >  src/conf/domain_conf.c | 14 +++++++-------
> >  1 file changed, 7 insertions(+), 7 deletions(-)
> > 
> > diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
> > index d8c1068..3062b3a 100644
> > --- a/src/conf/domain_conf.c
> > +++ b/src/conf/domain_conf.c
> > @@ -1461,6 +1461,13 @@ int
> >  virDomainDefSetVCpus(virDomainDefPtr def,
> >                       unsigned int vcpus)
> >  {
> > +    if (vcpus > def->maxvcpus) {
> 
> Use accessor (virDomainDefGetVCpusMax)

These are actually accessors to the vcpu related values, so using it
here is rather counterproductive. As you've probably noticed later
once def->vcpus becomes an array of structs, def->maxvcpus is the count
tracking element here, so this function really is a accessor to this
whole infrastructure, so I'll not change it.

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


More information about the libvir-list mailing list