[PATCH] fix create method on virt module

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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



###########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
 
 
-- 
1.5.4.1


###########END
-- 
Today is Setting Orange, the 67th day of Discord in the YOLD 3174

The absurd is the essential concept and the first truth.
		-- A. Camus

_______________________________________________
Func-list mailing list
Func-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/func-list

[Index of Archives]     [Fedora Users]     [Linux Networking]     [Fedora Legacy List]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]

  Powered by Linux