[libvirt] [PATCH v3 10/10] Allow balloon driver collection to be adjusted dynamically

Daniel P. Berrange berrange at redhat.com
Fri Jul 12 12:45:22 UTC 2013


On Thu, Jul 11, 2013 at 07:56:00PM -0400, John Ferlan wrote:
> Use the virDomainSetMemoryStatsPeriodFlags() to pass a period defined by
> usage of a new --period option in order to set the collection period for the
> balloon driver. This may enable or disable the collection based on the value.
> 
> Add the --current, --live, & --config options to dommemstat.
> ---
>  docs/formatdomain.html.in    | 11 +++++++-
>  tools/virsh-domain-monitor.c | 66 ++++++++++++++++++++++++++++++++++++++++++--
>  tools/virsh.pod              | 22 ++++++++++++++-
>  3 files changed, 94 insertions(+), 5 deletions(-)
> 
> diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
> index 93d2416..df84ed2 100644
> --- a/docs/formatdomain.html.in
> +++ b/docs/formatdomain.html.in
> @@ -4660,7 +4660,16 @@ qemu-kvm -net nic,model=? /dev/null
>          <p>
>            The optional <code>period</code> allows the QEMU virtio memory
>            balloon driver to provide statistics through the <code>virsh
> -          dommemstat [domain]</code> command.
> +          dommemstat [domain]</code> command. By default, collection is
> +          not enabled. In order to enable, use the <code>virsh dommemstat
> +          [domain] --period [number]</code> command or <code>virsh edit</code>
> +          command to add the option to the XML definition.
> +          The <code>virsh dommemstat</code> will accept the options
> +          <code>--live</code>, <code>--current</code>, or <code>--config</code>.
> +          If an option is not provided, the change for a running domain will
> +          only be made to the active guest.
> +          If the QEMU driver is not at the right
> +          revision, the attempt to set the period will fail.
>            <span class='since'>Since 1.1.1, requires QEMU 1.5</span>
>          </p>
>        </dd>
> diff --git a/tools/virsh-domain-monitor.c b/tools/virsh-domain-monitor.c
> index 5fbd32c..4cbf105 100644
> --- a/tools/virsh-domain-monitor.c
> +++ b/tools/virsh-domain-monitor.c
> @@ -314,6 +314,23 @@ static const vshCmdOptDef opts_dommemstat[] = {
>       .flags = VSH_OFLAG_REQ,
>       .help = N_("domain name, id or uuid")
>      },
> +    {.name = "period",
> +     .type = VSH_OT_DATA,
> +     .flags = VSH_OFLAG_EMPTY_OK,
> +     .help = N_("period in seconds to set collection")
> +    },

Hmm, I think I'd prefer to see the 'period' specified as a flag,
rather than positional arg. eg

  virsh dommemstat --period NNN

> @@ -668,10 +668,30 @@ Both I<--live> and I<--current> flags may be given, but I<--current> is
>  exclusive. If no flag is specified, behavior is different depending
>  on hypervisor.
>  
> -=item B<dommemstat> I<domain>
> +=item B<dommemstat> I<domain> [I<period> B<seconds>]
> +[[I<--config>] [I<--live>] | [I<--current>]]
>  
>  Get memory stats for a running domain.
>  
> +Depending on the hypervisor a variety of statistics can be returned
> +
> +For QEMU/KVM with a memory balloon, setting the optional I<period> to a
> +value larger than 0 in seconds will allow the balloon driver to return
> +additional statistics which will be displayed by subsequent B<dommemstat>
> +commands. Setting the I<period> to 0 will stop the balloon driver collection,
> +but does not clear the statistics in the balloon driver. Requires at least
> +QEMU/KVM 1.5 to be running on the host.
> +
> +The I<--live>, I<--config>, and I<--current> flags are only valid when using
> +the I<period> option in order to set the collection period for the balloon
> +driver. If I<--live> is specified, only the running guest collection period
> +is affected. If I<--config> is specified, affect the next boot of a persistent
> +guest. If I<--current> is specified, affect the current guest state.
> +
> +Both I<--live> and I<--config> flags may be given, but I<--current> is
> +exclusive. If no flag is specified, behavior is different depending
> +on the guest state.
> +
>  =item B<domblkerror> I<domain>
>  
>  Show errors on block devices.  This command usually comes handy when


Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|




More information about the libvir-list mailing list