Luca Foppiano wrote:
Hi all, create method on virt module doesn't work on xen domain based
machines because findByName connection method fails (XEN can see shutoff
virtual machines).
I add a simple code to use "xm create 'machinename'" to permit starting
machines by using machine name.
Here my patch :)
Luca
Thanks for the interest and patch, though this will not be applied.
There are libvirt API's for browsing inactive machines and starting them
-- virt-manager uses them -- and that's the way this should be done.
We will not be using Xen xm commands for Func because libvirt provides
us with a useful abstraction layer that is more programatically oriented.
I don't recall this support being busted but this is something I can
look at and retest next week.
--Michael
###########BEGIN
>From e62cb78e755f09f277b8ba5aa64cc79eaa739543 Mon Sep 17 00:00:00 2001
From: Luca Foppiano <lfoppiano@xxxxxxxxxxxxxxxxxxxx>
Date: Tue, 20 May 2008 12:20:17 +0200
Subject: [PATCH] Fix virt manager module to allow virtual machines
creation
on XEN.
---
func/minion/modules/virt.py | 18 +++++++++++++++++-
1 files changed, 17 insertions(+), 1 deletions(-)
diff --git a/func/minion/modules/virt.py b/func/minion/modules/virt.py
index 0828484..d2dd0a4 100644
--- a/func/minion/modules/virt.py
+++ b/func/minion/modules/virt.py
@@ -56,6 +56,8 @@ class FuncLibvirtConnection(object):
raise codes.FuncException("hypervisor connection failure")
self.conn = conn
+ self.type = conn.getType()
+
def find_vm(self, vmid):
"""
@@ -257,7 +259,21 @@ class Virt(func_module.FuncModule):
Start the machine via the given mac address.
"""
self.__get_conn()
- self.conn.create(vmid)
+
+ # If vmid is a virtualized XEN machine,
+ # is impossible to find it from a list of virtual machines
+ # if is of. So is necessary to create using xm command by
+ # command line.
+
+ if (self.conn.type == 'Xen'):
+ print "XEN command, using XM"
+ import command
+ comm = command.Command()
+ comm.run('xm create '+str(vmid))
+ else:
+ print "Qemu"
+ self.conn.create(vmid)
+
return 0
_______________________________________________
Func-list mailing list
Func-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/func-list