diff options
author | Adrian Likins <alikins@redhat.com> | 2008-07-19 13:11:22 -0400 |
---|---|---|
committer | Adrian Likins <alikins@redhat.com> | 2008-07-19 13:11:22 -0400 |
commit | 4154d23b8a32bfed9deff357ae0cc002ccf928c6 (patch) | |
tree | af027658b3e4be5c4ecdefb19793e591e84e5142 /func | |
parent | f471627c772b744e4df5707d5c8db1e3453401b9 (diff) | |
parent | 6d30e9546486c7dcb977278b6a8d90eee3d9976c (diff) | |
download | func-4154d23b8a32bfed9deff357ae0cc002ccf928c6.tar.gz func-4154d23b8a32bfed9deff357ae0cc002ccf928c6.tar.xz func-4154d23b8a32bfed9deff357ae0cc002ccf928c6.zip |
Merge branch 'mhicks'
Diffstat (limited to 'func')
-rw-r--r-- | func/minion/modules/virt.py | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/func/minion/modules/virt.py b/func/minion/modules/virt.py index ba5759e..2c68ab4 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,39 @@ class Virt(func_module.FuncModule): pass return results + def virttype(self): + return self.__get_conn().get_type() + + 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: + # When using KVM, we need to make sure the autostart + # directory exists + mkdir_args = [ + "/bin/mkdir", + "-p", + "/etc/libvirt/qemu/autostart" + ] + sub_process.call(mkdir_args,shell=False,close_fds=True) + + # We aren't using virsh autostart because we want + # the command to work even when the VM isn't running + autostart_args = [ + "/bin/ln", + "-s", + "/etc/libvirt/qemu/%s.xml" % vm, + "/etc/libvirt/qemu/autostart/%s.xml" % 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 |