summaryrefslogtreecommitdiffstats
path: root/func
diff options
context:
space:
mode:
authorMatt Hicks <mhicks@localhost.localdomain>2008-07-17 16:52:08 -0400
committerMatt Hicks <mhicks@localhost.localdomain>2008-07-17 16:52:08 -0400
commit434f2ea877b95486b59047bd6fa63fba69b2fdfd (patch)
tree8ea40bd95557d74200d9dff039e6e894e71c9260 /func
parent7c365f3d708451c4926eed5f58c837dbe613b2e8 (diff)
downloadthird_party-func-434f2ea877b95486b59047bd6fa63fba69b2fdfd.tar.gz
third_party-func-434f2ea877b95486b59047bd6fa63fba69b2fdfd.tar.xz
third_party-func-434f2ea877b95486b59047bd6fa63fba69b2fdfd.zip
Adding an autostart method that creates the symbolic link
for autostarting on Xen and uses the virsh call to autostart when on KVM.
Diffstat (limited to 'func')
-rw-r--r--func/minion/modules/virt.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/func/minion/modules/virt.py b/func/minion/modules/virt.py
index ba5759e..e6a896a 100644
--- a/func/minion/modules/virt.py
+++ b/func/minion/modules/virt.py
@@ -122,6 +122,9 @@ class FuncLibvirtConnection(object):
def nodeinfo(self):
return self.conn.getInfo()
+ def get_type(self):
+ return self.conn.getType()
+
class Virt(func_module.FuncModule):
@@ -184,6 +187,24 @@ class Virt(func_module.FuncModule):
pass
return results
+ def autostart(self, vm):
+ self.conn = self.__get_conn()
+ if self.conn.get_type() == "Xen":
+ autostart_args = [
+ "/bin/ln",
+ "-s",
+ "/etc/xen/%s" % vm,
+ "/etc/xen/auto"
+ ]
+ else:
+ autostart_args = [
+ "/usr/bin/virsh",
+ "autostart",
+ vm
+ ]
+
+ return sub_process.call(autostart_args,shell=False,close_fds=True)
+
def freemem(self):
self.conn = self.__get_conn()
# Start with the physical memory and subtract