Skip to contentSkip to conversation

Prevent attachment of devices in dom0

PATCH In review [email protected] 2 participants 2 messages Jun 14, 2007

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Prevent attachment of devices in dom0

# HG changeset patch
# User [email protected]
# Date 1181861914 25200
# Node ID 7790a6395ed398fffb85ec8eef184d6c8c83b8c4 # Parent 1e09661173844517d8c7b73822d2067afed2d098 Prevent attachment of devices in dom0

tools/python/xen/xend/XendDomainInfo.py +4 -0
@@ -497,6 +497,10 @@ class XendDomainInfo:
         @param dev_config: device configuration
         @type  dev_config: SXP object (parsed config)
         """
+
+        if self.domid == 0:
+            raise XendError('Devices cannot be attached to Domain 0')
+
         log.debug("XendDomainInfo.device_create: %s" % scrub_password(dev_config))
         dev_type = sxp.name(dev_config)
         dev_uuid = self.info.device_add(dev_type, cfg_sxp = dev_config)
#1 lore raw

I'd prefer to be able to block-attach things in domain 0 on occasion. It's a pretty convenient way to set up and maintain blocktap filesystems. Maybe you can move this policy somewhere closer to the problem you are fixing?

Quoted 27 lines · On Thursday, 14 June 2007 at 16:00, [email protected] wrote:

# HG changeset patch
# User [email protected]
# Date 1181861914 25200
# Node ID 7790a6395ed398fffb85ec8eef184d6c8c83b8c4 # Parent 1e09661173844517d8c7b73822d2067afed2d098 Prevent attachment of devices in dom0

tools/python/xen/xend/XendDomainInfo.py +5 -0
+++ b/tools/python/xen/xend/XendDomainInfo.py
@@ -497,6 +497,10 @@ class XendDomainInfo:
         @param dev_config: device configuration
         @type  dev_config: SXP object (parsed config)
         """
+
+        if self.domid == 0:
+            raise XendError('Devices cannot be attached to Domain 0')
+
         log.debug("XendDomainInfo.device_create: %s" % scrub_password(dev_config))
         dev_type = sxp.name(dev_config)
         dev_uuid = self.info.device_add(dev_type, cfg_sxp = dev_config)

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel