summaryrefslogtreecommitdiffstats
path: root/func
diff options
context:
space:
mode:
authorMichael DeHaan <mdehaan@redhat.com>2008-06-24 13:42:29 -0400
committerMichael DeHaan <mdehaan@redhat.com>2008-06-24 13:42:29 -0400
commit5525101004593056b3b9006dc1fbdce73c4563e5 (patch)
treecb5b1f3cd461fc9d43b995c98e386cd487bf2bec /func
parent5aeaa5a411c2e5b8f297ba1eed02aa2663ff7225 (diff)
downloadthird_party-func-5525101004593056b3b9006dc1fbdce73c4563e5.tar.gz
third_party-func-5525101004593056b3b9006dc1fbdce73c4563e5.tar.xz
third_party-func-5525101004593056b3b9006dc1fbdce73c4563e5.zip
Applying Matt Hicks' patches to enhance the virt modules.
Diffstat (limited to 'func')
-rw-r--r--func/minion/modules/virt.py29
1 files changed, 26 insertions, 3 deletions
diff --git a/func/minion/modules/virt.py b/func/minion/modules/virt.py
index 0828484..40ae274 100644
--- a/func/minion/modules/virt.py
+++ b/func/minion/modules/virt.py
@@ -184,7 +184,25 @@ class Virt(func_module.FuncModule):
pass
return results
- def install(self, server_name, target_name, system=False):
+ def freemem(self):
+ self.conn = self.__get_conn()
+ # Start with the physical memory and subtract
+ memory = self.conn.nodeinfo()[1]
+
+ # Take 256M off which is reserved for Domain-0
+ memory = memory - 256
+
+ vms = self.conn.find_vm(-1)
+ for vm in vms:
+ # Exclude stopped vms and Domain-0 by using
+ # ids greater than 0
+ if vm.ID() > 0:
+ # This node is active - remove its memory (in bytes)
+ memory = memory - int(vm.info()[2])/1024
+
+ return memory
+
+ def install(self, server_name, target_name, system=False, virt_name=None, virt_path=None):
"""
Install a new virt system by way of a named cobbler profile.
@@ -192,6 +210,7 @@ class Virt(func_module.FuncModule):
# Example:
# install("bootserver.example.org", "fc7webserver", True)
+ # install("bootserver.example.org", "client.example.org", True, "client-disk0", "HostVolGroup00")
conn = self.__get_conn()
@@ -204,15 +223,19 @@ class Virt(func_module.FuncModule):
if system:
target = "system"
- # TODO: FUTURE: set --virt-path in cobbler or here
koan_args = [
"/usr/bin/koan",
"--virt",
- "--virt-graphics", # enable VNC
"--%s=%s" % (target, target_name),
"--server=%s" % server_name
]
+ if virt_name:
+ koan_args.append("--virt-name=%s" % virt_name)
+
+ if virt_path:
+ koan_args.append("--virt-path=%s" % virt_path)
+
rc = sub_process.call(koan_args,shell=False)
if rc == 0:
return 0