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

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




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

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.