diff options
author | Matt Hicks <mhicks@localhost.localdomain> | 2008-07-17 16:52:08 -0400 |
---|---|---|
committer | Matt Hicks <mhicks@localhost.localdomain> | 2008-07-17 16:52:08 -0400 |
commit | 434f2ea877b95486b59047bd6fa63fba69b2fdfd (patch) | |
tree | 8ea40bd95557d74200d9dff039e6e894e71c9260 /func | |
parent | 7c365f3d708451c4926eed5f58c837dbe613b2e8 (diff) | |
download | third_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.py | 21 |
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 |