WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

Re: [Xen-devel] Question about vcpu_avail

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: Re: [Xen-devel] Question about vcpu_avail
From: Michal Novotny <minovotn@xxxxxxxxxx>
Date: Tue, 24 Nov 2009 12:27:30 +0100
Delivery-date: Tue, 24 Nov 2009 03:28:03 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <C7305AB5.11CC%keir.fraser@xxxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <C7305AB5.11CC%keir.fraser@xxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.4pre) Gecko/20091014 Fedora/3.0-2.8.b4.fc11 Thunderbird/3.0b4
On 11/23/2009 04:28 PM, Keir Fraser wrote:
On 23/11/2009 15:02, "Michal Novotny"<minovotn@xxxxxxxxxx>  wrote:

I would like to ask about vcpu_avail variable in XendDomainInfo.py. Is
that variable working and what is it used for ? I think it's a bitmask
showing what VCPUs are used and what are not, am I correct?
Yes, it allows you to configure which VCPUs are brought online by default on
guest bootup. If you do add a maxvcpus config item, it can be parsed out
into vcpus and vcpu_avail entirely within xm's create.py (excuse dodgy
pseudocode):
  if defined(maxvcpus):
      vcpu_avail = (1<<  vcpus) - 1
      vcpus = maxvcpus

i.e., no need for xend itself to know about the new config item.

  -- Keir


Well, I don't know Keir since the main use scenario for maxvcpus is to set number of vcpus for the guest so a new definition in Xend should be required.

Then you just issue `xm vcpu-set {domainName} {numberOfVcpus}` command to change number of VCPUs used by the guest, method `setVCpuCount(self, vcpus)` from XendDomainInfo.py is called to set number of VCpus so check should be implemented here as:

     def setVCpuCount(self, vcpus):
        if vcpus > self.info['maxvcpus']:
            log.debug("Cannot set %d vcpu(s) for domain %s (domid %d)."
                      "Maximum number of vcpu(s) is set to %d" %
                                (vcpus, self.info['name'], self.domid,
                                 self.info['maxvcpus']))
raise VmError("Cannot set %d vcpu(s). Maximum number of vcpus for " "this domain is %d" % (vcpus, self.info['maxvcpus']) )

         self.info['vcpu_avail'] = (1 << vcpus) - 1
         self.storeVm('vcpu_avail', self.info['vcpu_avail'])

And domain_max_vcpus() call should be changed from `xc.domain_max_vcpus(self.domid, int(self.info['vcpus']))` to `xc.domain_max_vcpus(self.domid, int(self.info['maxvcpus']))`.

The only change that should be done to xm/create.py is to add `maxvcpus` to add_conf mapping to allow it to be read/parsed out from the config file.

Well, I've been looking to the code and there is self.info['VCPUs_max'] in XendDomainInfo.py. What is it used for? Could it be used for the same purpose like `maxvcpus` from example above?

Michal

Also, I'm
thinking of adding some variable of `maxvcpus` to define maximum number
of vcpus for PV guests. This way we could define a config file like:

vcpus = 2
maxvcpus = 4

and by setting `xm vcpu-set {domain} {numberOfVCPUs}` we can set up to 4
vcpus. Current behavior is to set to 1 vcpu and back to 2 vcpus but
never to cross the number defined in of vcpus. Now we could be able to
allocate up to 4 vcpus to the guest and not just 2... What do you think
about that idea?


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel