Stefan Berger
2006-Oct-04  02:48 UTC
[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@us.ibm.com>
--- 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@lists.xensource.com
http://lists.xensource.com/xen-devel
Doi.Tsunehisa@jp.fujitsu.com
2006-Oct-04  03:34 UTC
Re: [Xen-devel] [RFC] 2nd -- Disallowing xm operations on HVM domains
Hi, You (stefanb) said:> 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.I''m wondering that you don''t consider about PV-on-HVM drivers. On a HVM domain with PV-on-HVM VBD driver, it can be attached a block device with xm block-attach command. Thanks, - Tsunehisa Doi _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Stefan Berger
2006-Oct-04  13:36 UTC
Re: [Xen-devel] [RFC] 2nd -- Disallowing xm operations on HVM domains
micky@photon.sky.yk.fujitsu.co.jp wrote on 10/03/2006 11:34:39 PM:> Hi, > > You (stefanb) said: > > Previous patch would only work once a domain has been started. :-/This> > one here fixes the startup problem and does not allow to attach ablock> > device to an HVM domain once the domain has been started. Migrationcan> > also be prevented. > > I''m wondering that you don''t consider about PV-on-HVM drivers. > > On a HVM domain with PV-on-HVM VBD driver, it can be attached > a block device with xm block-attach command.Right, I had not thought of that. Block-attach and network-attach have to still go through. That leaves the usefulness to migration and few others. Stefan _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel