WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [RFC] 2nd -- Disallowing xm operations on HVM domains

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [RFC] 2nd -- Disallowing xm operations on HVM domains
From: Stefan Berger <stefanb@xxxxxxxxxx>
Date: Tue, 3 Oct 2006 22:48:51 -0400
Delivery-date: Tue, 03 Oct 2006 19:49:23 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx

Previous patch would only work once a domain has been started. :-/ This one here fixes the startup problem and does not allow to attach a block device to an HVM domain once the domain has been started. Migration can also be prevented.

Signed-off-by: Stefan Berger <stefanb@xxxxxxxxxx>


--- a/tools/python/xen/xend/XendDomainInfo.py                 Tue Oct  3 10:39:22 2006
+++ b/tools/python/xen/xend/XendDomainInfo.py                 Tue Oct  3 22:42:33 2006
@@ -468,6 +468,8 @@
        self.refresh_shutdown_lock = threading.Condition()

        self.setResume(resume)
+        
+        self.has_started = False

    ## private:

@@ -1081,8 +1083,14 @@


    ## private:
+    
+    def disallowForHVM(self):
+        if self.info['image'][0] == "hvm" and self.has_started:
+           raise XendError("Operation not allow on HVM-type domain.")
+

    def createDevice(self, deviceClass, devconfig):
+        self.disallowForHVM()
        return self.getDeviceController(deviceClass).createDevice(devconfig)


@@ -1621,6 +1629,7 @@


    def unpause(self):
+        self.has_started = True
        xc.domain_unpause(self.domid)
diff -r 38f9bd7a4ce6 tools/python/xen/xend/XendDomain.py
--- a/tools/python/xen/xend/XendDomain.py                 Tue Oct  3 10:39:22 2006
+++ b/tools/python/xen/xend/XendDomain.py                 Tue Oct  3 22:42:33 2006
@@ -432,6 +432,8 @@

        if dominfo.getDomid() == PRIV_DOMAIN:
            raise XendError("Cannot migrate privileged domain %s" % domid)
+            
+        dominfo.disallowForHVM()

        """ The following call may raise a XendError exception """
        dominfo.testMigrateDevices(True, dst)
diff -r 38f9bd7a4ce6 tools/python/xen/xend/XendDomainInfo.py


Certain operations, such as for example 'xm block-attach' don't work on HVM domains and should be intercepted in xend. The following patch shows an example of how this could be done. When run, unfortunately the usage of block-detach is still shown.

  Stefan

diff -r 38f9bd7a4ce6 tools/python/xen/xend/XendDomainInfo.py
--- a/tools/python/xen/xend/XendDomainInfo.py                 Tue Oct  3 10:39:22 2006
+++ b/tools/python/xen/xend/XendDomainInfo.py                 Tue Oct  3 21:05:11 2006
@@ -1081,8 +1081,14 @@


    ## private:
+    
+    def disallowHVM(self):
+        if self.info['image'][0] == "hvm":
+           raise XendError("Operation not allow on HVM-type domain.")
+            

    def createDevice(self, deviceClass, devconfig):
+        self.disallowHVM()
        return self.getDeviceController(deviceClass).createDevice(devconfig)

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
<Prev in Thread] Current Thread [Next in Thread>