func/minion

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



 func/minion/modules/disk.py |    6 ++--
 func/minion/modules/virt.py |   59 ++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 62 insertions(+), 3 deletions(-)

New commits:
commit 0b0b0f0d26d180315f5d3c343b04ea5af839dbe0
Author: Greg Swift <gregswift@xxxxxxxxx>
Date:   Fri Sep 3 11:08:49 2010 -0400

    disk.py  - Adjusted return values to be strings instead of integers since XMLRPC fails on larger than 32bit numbers
    virt.py - added several libvirt references for memory and cpu

diff --git a/func/minion/modules/disk.py b/func/minion/modules/disk.py
index f9a2c55..a2f0767 100644
--- a/func/minion/modules/disk.py
+++ b/func/minion/modules/disk.py
@@ -36,9 +36,9 @@ class DiskModule(func_module.FuncModule):
                 continue
             (device, total, used, available, percentage, mount) = disk.split()
             results[mount] = {'device':device,
-                              'total':int(total),
-                              'used':int(used),
-                              'available':int(available),
+                              'total':str(total),
+                              'used':str(used),
+                              'available':str(available),
                               'percentage':int(percentage[:-1])}
         return results
 
diff --git a/func/minion/modules/virt.py b/func/minion/modules/virt.py
index 3d27610..b0d6061 100644
--- a/func/minion/modules/virt.py
+++ b/func/minion/modules/virt.py
@@ -130,6 +130,26 @@ class FuncLibvirtConnection(object):
     def get_type(self):
         return self.conn.getType()
 
+    def set_vcpus(self, vmid, num):
+        vm = self.conn.lookupByName(vmid)
+        return vm.setVcpus(num)
+
+    def get_maxVcpus(self, vmid):
+        vm = self.conn.lookupByName(vmid)
+        return vm.maxVcpus()
+
+    def set_maxMemory(self, vmid, amount):
+        vm = self.conn.lookupByName(vmid)
+        return vm.setMaxMemory(amount)
+
+    def get_maxMemory(self, vmid):
+        vm = self.conn.lookupByName(vmid)
+        return vm.maxMemory()
+
+    def set_memory(self, vmid, amount):
+        vm = self.conn.lookupByName(vmid)
+        return vm.setMemory(amount)
+
 
 class Virt(func_module.FuncModule):
 
@@ -444,3 +464,42 @@ class Virt(func_module.FuncModule):
 		return (-1,'Config file /etc/libvirt/qemu/%s.xml not found' % vmid)
 	return (-2,'Unmatched Condition in set_graphics method')
 
+    def set_vcpus(self, vmid, num):
+        """
+        Sets the number of VCPUs on a guest
+        """
+
+        self.__get_conn()
+        return self.conn.set_vcpus(num)
+
+    def get_maxVcpus(self, vmid):
+        """
+        Gets the max number of VCPUs on a guest
+        """
+
+        self.__get_conn()
+        return self.conn.get_maxVcpus(num)
+
+    def set_maxMemory(self, vmid, amount):
+        """
+        Sets the max memory on a guest
+        """
+
+        self.__get_conn()
+        return self.conn.set_maxMemory(vmid, amount)
+
+    def get_maxMemory(self, vmid):
+        """
+        Gets the max memory on a guest
+        """
+
+        self.__get_conn()
+        return self.conn.set_getMaxMemory(vmid)
+
+    def set_memory(self, vmid, amount):
+        """
+        Sets the memory on a guest
+        """
+
+        self.__get_conn()
+        return self.conn.set_memory(vmid, amount)


_______________________________________________
Func-list mailing list
Func-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/func-list


[Index of Archives]     [Fedora Users]     [Linux Networking]     [Fedora Legacy List]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]

  Powered by Linux