On 31/08/12 22:07, Chris Evich wrote:
On 08/28/2012 11:39 AM, Yu Mingfei wrote:
Signed-off-by: Yu Mingfei<[email protected]>
---
  client/virt/libvirt_vm.py |   14 ++++++++++++++
  1 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/client/virt/libvirt_vm.py b/client/virt/libvirt_vm.py
index 996a185..559bb9e 100644
--- a/client/virt/libvirt_vm.py
+++ b/client/virt/libvirt_vm.py
@@ -658,6 +658,20 @@ def virsh_pool_create_as(name, _type, target,
extra="", uri=""):
          return False


+def virsh_setmem(name, size, options="", uri="",
+                 ignore_status=False, print_info=False):
+    """
+    Change the current memory allocation in the guest domain.
+
+    @param name: name of domain.
+    @param size: the memory size to set.
+    @param options: options of command virsh setmem, it can be
+                --config/--live/--current or mix them.
+    """

Thanks for putting full API docstring. This helps me a lot. One small thing- Please put the units in 'memory size to set'. I always forget if this is suppose to be KB or MB!
I understand what you worry about.^^
My consideration is if we use it on older libvirt, just set options null.

It seems that only kilobytes is supported, and I will add --kilobytes to cmd.:-)

Thanks
Yu


Don't worry about it for now, but we'll need to do some special handling in this function for older libvirt. The options for this command are completely different :(

# virsh help setmem
  NAME
    setmem - change memory allocation

  SYNOPSIS
    setmem <domain> <kilobytes>

  DESCRIPTION
    Change the current memory allocation in the guest domain.

  OPTIONS
    [--domain] <string>  domain name, id or uuid
    [--kilobytes] <string>  number of kilobytes of memory

+    cmd = "setmem --domain %s %s %s" % (name, size, options)
+    return virsh_cmd(cmd, uri, ignore_status, print_info)
+
+
  class VM(virt_vm.BaseVM):
      """
      This class handles all basic VM operations for libvirt.
-- 1.7.1

--
Best Regards
Yu Mingfei





--
Best Regards
Yu Mingfei

_______________________________________________
Autotest-kernel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/autotest-kernel

Reply via email to