Hey,

I found ConVirt a few days ago and I have to say that it is a really handy tool!

During my tests I found a number of small problems and limitations
the attached patches reflect my changes. Since I have no knowledge
about python the patches need some reviewing.

Is there a central repository that is used to maintain the software?
My changes were made to the latest (0.9.6) version I could find.


The following things were changed:

 * changed pause and migrate syntax to match new qemu-style syntax in
        0001-changed-pause-and-migrate-syntax-to-match-new-qemu.patch

 * added support for the KVM "-serial <args>" switch in the config
        0002-added-support-for-the-KVM-serial-args-switch-i.patch

 * added support for the KVM "usbdevice" switch in the config this is especial 
usefull for vnc mouse sync
        0003-added-support-for-the-KVM-usbdevice-switch-in-the.patch

 * added support to run a KVM instance as other user than root
        0004-added-support-to-run-a-KVM-instance-as-other-user-th.patch
        0005-added-missing-definition-of-USER-to-function-start.patch

 * allow top to exit with return value 1 and still parse the output
        0006-allow-top-to-exit-with-return-value-1-and-still-par.patch

The patches can be found at:
        http://flipstar.net/tmp/convirt/patches_0.9.6/

--
regards
flip

>From 50632a69f25013c3bb62556c2d4f2197cbcee3c5 Mon Sep 17 00:00:00 2001
From: Philipp Wehrheim <wehrh...@dv.fh-frankfurt.de>
Date: Wed, 10 Dec 2008 08:58:44 +0100
Subject: [PATCH]  changed pause and migrate syntax to match new qemu-style 
syntax in
    /src/convirt/core/platforms/kvm/KVMProxy.py

---
 .../src/convirt/core/platforms/kvm/KVMProxy.py     |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/convirt-0.9.6/src/convirt/core/platforms/kvm/KVMProxy.py 
b/convirt-0.9.6/src/convirt/core/platforms/kvm/KVMProxy.py
index 68b562f..35507f4 100644
--- a/convirt-0.9.6/src/convirt/core/platforms/kvm/KVMProxy.py
+++ b/convirt-0.9.6/src/convirt/core/platforms/kvm/KVMProxy.py
@@ -673,7 +673,7 @@ class KVMProxy(VMM):
         if prompt and output == cmd:
             # vm stopped now lets use migrate to save it to the file
             # save vmconfig context ?
-            cmd = "migrate " + "file://" + filename 
+            cmd = "migrate " + "file:" + filename 
             (output,prompt) = self.send_command(id, cmd)
             if prompt and output == cmd:
                 print "vm state saved to " + filename
@@ -700,7 +700,7 @@ class KVMProxy(VMM):
                 filename = filename[0:-4]
         
         cfg = self.node.new_config(ctx_file)
-        cfg["incoming"] = "file://" + filename
+        cfg["incoming"] = "file:" + filename
         self.start(cfg)
 
     def quit_vm(self,id):
@@ -740,7 +740,7 @@ class KVMProxy(VMM):
         #        listen on all interfaces.
 
         print "LIVE MiGRATION ", live
-        cfg["incoming"] = "tcp://0:" + str(port)
+        cfg["incoming"] = "tcp:0:" + str(port)
 
         try:
             dst.create_dom(cfg)
@@ -763,7 +763,7 @@ class KVMProxy(VMM):
                 else:
                     raise Exception("error stopping VM during migration :" + 
output)
             
-            cmd = "migrate tcp://" + dst.get_address() +":"+str(port)
+            cmd = "migrate tcp:" + dst.get_address() +":"+str(port)
             print "Initiating migration ", cmd
             (output,prompt) = self.send_command(id,cmd)
             if prompt and output == cmd:
-- 
1.5.4.5


>From 4705616e7766382aa626fe1fd2bc88746cc9507e Mon Sep 17 00:00:00 2001
From: Philipp Wehrheim <wehrh...@dv.fh-frankfurt.de>
Date: Thu, 11 Dec 2008 08:31:57 +0100
Subject: [PATCH]  added support for the KVM "-serial <args>" switch in the 
config

  ...
  serial='unix:/tmp/serial,server,nowait'
  ...
---
 .../src/convirt/core/platforms/kvm/KVMProxy.py     |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/convirt-0.9.6/src/convirt/core/platforms/kvm/KVMProxy.py 
b/convirt-0.9.6/src/convirt/core/platforms/kvm/KVMProxy.py
index 35507f4..cb4c372 100644
--- a/convirt-0.9.6/src/convirt/core/platforms/kvm/KVMProxy.py
+++ b/convirt-0.9.6/src/convirt/core/platforms/kvm/KVMProxy.py
@@ -475,6 +475,9 @@ class KVMProxy(VMM):
             opt = opt.replace("_", "-") # python prohibits - in variables
             if opt == "extra":
                 opt = "append"
+               
+            if opt == "serial":
+                opt = "serial"
 
             if opt == "memory" :
                 opt = "m"
-- 
1.5.4.5


>From 5ea177b62a744f90987aaf23a87b26468b8c0f27 Mon Sep 17 00:00:00 2001
From: Philipp Wehrheim <wehrh...@dv.fh-frankfurt.de>
Date: Thu, 11 Dec 2008 09:23:30 +0100
Subject: [PATCH] added support for the KVM "usbdevice" switch in the config
  this is especial usefull for vnc mouse sync
  aka -usbdevice tablet

  ...
  usbdevice='tablet'
  ...
---
 .../src/convirt/core/platforms/kvm/KVMProxy.py     |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/convirt-0.9.6/src/convirt/core/platforms/kvm/KVMProxy.py 
b/convirt-0.9.6/src/convirt/core/platforms/kvm/KVMProxy.py
index cb4c372..5670988 100644
--- a/convirt-0.9.6/src/convirt/core/platforms/kvm/KVMProxy.py
+++ b/convirt-0.9.6/src/convirt/core/platforms/kvm/KVMProxy.py
@@ -478,6 +478,9 @@ class KVMProxy(VMM):
                
             if opt == "serial":
                 opt = "serial"
+               
+            if opt == "usbdevice":
+                opt = "usbdevice"
 
             if opt == "memory" :
                 opt = "m"
-- 
1.5.4.5


>From 835fc43675e04e92f6998b01210a25d8376498a1 Mon Sep 17 00:00:00 2001
From: Philipp Wehrheim <wehrh...@dv.fh-frankfurt.de>
Date: Thu, 11 Dec 2008 10:05:42 +0100
Subject: [PATCH] added support to run a KVM instance as other user than root
  - this is more or less a hack and needs some love
  - sudo has to be in $PATH

 add ... to the config file
 ...
 runas='pw'
 ...
---
 .../src/convirt/core/platforms/kvm/KVMProxy.py     |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/convirt-0.9.6/src/convirt/core/platforms/kvm/KVMProxy.py 
b/convirt-0.9.6/src/convirt/core/platforms/kvm/KVMProxy.py
index 5670988..469707e 100644
--- a/convirt-0.9.6/src/convirt/core/platforms/kvm/KVMProxy.py
+++ b/convirt-0.9.6/src/convirt/core/platforms/kvm/KVMProxy.py
@@ -482,6 +482,10 @@ class KVMProxy(VMM):
             if opt == "usbdevice":
                 opt = "usbdevice"
 
+           if opt == "runas"
+               USER = value
+               continue
+
             if opt == "memory" :
                 opt = "m"
             elif opt == "vcpus":
@@ -595,6 +599,11 @@ class KVMProxy(VMM):
                     
         # daemonize.. the command can return
         cmdline = cmdline + " -daemonize"
+       
+        # if runas was set in the configfile pretend "sudo -u <user>"
+       # to the cmdline
+       if USER:
+           cmdline = "sudo -u " + USER + " " + cmdline
 
         #incoming_val = config.get("incoming")
         #if incoming_val and (incoming_val.find("tcp://") == 0 or \
-- 
1.5.4.5


>From 5a3389b69ff5ad27d7f996b50a037a4c57698cf0 Mon Sep 17 00:00:00 2001
From: Philipp Wehrheim <wehrh...@dv.fh-frankfurt.de>
Date: Thu, 11 Dec 2008 11:46:10 +0100
Subject: [PATCH]  added missing definition of USER to function start()

---
 .../src/convirt/core/platforms/kvm/KVMProxy.py     |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/convirt-0.9.6/src/convirt/core/platforms/kvm/KVMProxy.py 
b/convirt-0.9.6/src/convirt/core/platforms/kvm/KVMProxy.py
index 469707e..f81b8ea 100644
--- a/convirt-0.9.6/src/convirt/core/platforms/kvm/KVMProxy.py
+++ b/convirt-0.9.6/src/convirt/core/platforms/kvm/KVMProxy.py
@@ -428,6 +428,7 @@ class KVMProxy(VMM):
 
     # Use the config and start a new vm.
     def start(self,config):
+       USER = ""
         if config is None:
             raise Exception("No context provided to start the vm")
 
-- 
1.5.4.5


>From 0eac941bd46f972bcc0ff0b04ebf31699404fb17 Mon Sep 17 00:00:00 2001
From: Philipp Wehrheim <wehrh...@dv.fh-frankfurt.de>
Date: Thu, 11 Dec 2008 11:51:19 +0100
Subject: [PATCH]  allow top to exit with return value 1 and still parse the 
output

---
 .../src/convirt/core/platforms/kvm/KVMNode.py      |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/convirt-0.9.6/src/convirt/core/platforms/kvm/KVMNode.py 
b/convirt-0.9.6/src/convirt/core/platforms/kvm/KVMNode.py
index 4eeff25..bfae93b 100644
--- a/convirt-0.9.6/src/convirt/core/platforms/kvm/KVMNode.py
+++ b/convirt-0.9.6/src/convirt/core/platforms/kvm/KVMNode.py
@@ -146,9 +146,12 @@ class KVMNode(VNode):
         frame = {} # the output metric frame (dict of dict's)
         (retbuf, retcode) = self.node_proxy.exec_cmd(FRAME_CMD,
                                                      self.exec_path)
-        if retcode:
+        if retcode > 1:
             print FRAME_CMD
-            print "ERROR : cmd = (%s) \n retcode is not 0, error :%s" % 
(FRAME_CMD,
+           # HACK
+           # on my hardend amd64 top always returns 1
+           # - is this a system bug or a procps bug?
+            print "ERROR : cmd = (%s) \n retcode is greater than 1, error :%s" 
% (FRAME_CMD,
                                                                          
retbuf)
             return None
 
-- 
1.5.4.5


------------------------------------------------------------------------------
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
The future of the web can't happen without you.  Join us at MIX09 to help
pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
_______________________________________________
XenMan-Users mailing list
XenMan-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/xenman-users

Reply via email to