[libvirt] [PATCH 5/5] setmem: add the new options to "virsh setmem" command

Eric Blake eblake at redhat.com
Thu Mar 10 22:09:35 UTC 2011


On 03/02/2011 01:13 AM, Taku Izumi wrote:
> 
> This patch adds the new options (--live and --config)  to "virsh setmem" command.
> The behavior of above options is the same as that of "virsh setvcpus" and so on.
> That is, when the --config option is specified, a modification is effective for
> the persistent domain. Moreover we can modify the memory size of inactive domains
> as well as that of active domains.
> 
> @@ -2920,6 +2922,10 @@ cmdSetmem(vshControl *ctl, const vshCmd
>      virDomainInfo info;
>      unsigned long kilobytes;
>      int ret = TRUE;
> +    int config = vshCommandOptBool(cmd, "config");
> +    int live = vshCommandOptBool(cmd, "live");
> +    int flags = ((config ? VIR_DOMAIN_MEM_CONFIG : 0) |
> +                 (live ? VIR_DOMAIN_MEM_LIVE : 0));

I folded in Daniel's suggestion to call the older API when only --live
was requested (actually, I did it differently - flags only has to be set
if config is specified).

You forgot documentation in tools/virsh.pod.  I'm adding:

diff --git i/tools/virsh.pod w/tools/virsh.pod
index a2ca384..7c12399 100644
--- i/tools/virsh.pod
+++ w/tools/virsh.pod
@@ -578,9 +578,12 @@ Therefore, -1 is a useful shorthand for 262144.
 B<Note>: The weight and cap parameters are defined only for the
 XEN_CREDIT scheduler and are now I<DEPRECATED>.

-=item B<setmem> I<domain-id> B<kilobytes>
+=item B<setmem> I<domain-id> B<kilobytes> optional I<--config> I<--live>

-Immediately change the current memory allocation for an active guest
domain.
+Change the memory allocation for a guest domain.
+If I<--live> is specified, perform a memory balloon of a running guest.
+If I<--config> is specified, affect the next boot of a persistent guest.
+Both flags may be given.  If neither flag is given, I<--live> is assumed.

 Some hypervisors require a larger granularity than kilobytes, and requests
 that are not an even multiple will be rounded up.  For example, vSphere/ESX
@@ -590,10 +593,6 @@ rounds the parameter up unless the kB argument is
evenly divisible by 1024
 For Xen, you can only adjust the memory of a running domain if the
domain is
 paravirtualized or running the PV balloon driver.

-Note, this command only works on active guest domains.  To change the
memory
-allocation for an inactive guest domain, use the virsh B<edit> command to
-update the XML <currentMemory> element.
-
 =item B<setmaxmem> I<domain-id> B<kilobytes>

 Change the maximum memory allocation limit for an inactive guest domain.


At any rate, ACK as modified, and I pushed the amended series.  Thanks
again for your first contribution!

-- 
Eric Blake   eblake at redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 619 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20110310/4f8cb014/attachment-0001.sig>


More information about the libvir-list mailing list