From ec7895237498a37ccbfb4667e809e63903ca61db Mon Sep 17 00:00:00 2001 From: Keir Fraser Date: Thu, 21 Jan 2010 14:40:05 +0000 Subject: [PATCH] xend: Dis-allow device assignment if PoD is enabled. Signed-off-by: Dongxiao Xu --- tools/python/xen/xend/XendDomainInfo.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/tools/python/xen/xend/XendDomainInfo.py b/tools/python/xen/xend/XendDomainInfo.py index 89316337ab..491a940117 100644 --- a/tools/python/xen/xend/XendDomainInfo.py +++ b/tools/python/xen/xend/XendDomainInfo.py @@ -390,6 +390,14 @@ class XendDomainInfo: self.domid = domid self.guest_bitsize = None self.alloc_mem = None + + maxmem = self.info.get('memory_static_max', 0) + memory = self.info.get('memory_dynamic_max', 0) + + if maxmem > memory: + self.pod_enabled = True + else: + self.pod_enabled = False #REMOVE: uuid is now generated in XendConfig #if not self._infoIsSet('uuid'): @@ -694,11 +702,18 @@ class XendDomainInfo: return self.hvm_pci_device_insert_dev(new_dev) + def iommu_check_pod_mode(self): + """ Disallow PCI device assignment if pod is enabled. """ + if self.pod_enabled: + raise VmError("failed to assign device since pod is enabled") + def pci_dev_check_assignability_and_do_FLR(self, config): """ In the case of static device assignment(i.e., the 'pci' string in guest config file), we check if the device(s) specified in the 'pci' can be assigned to guest or not; if yes, we do_FLR the device(s). """ + + self.iommu_check_pod_mode() pci_dev_ctrl = self.getDeviceController('pci') return pci_dev_ctrl.dev_check_assignability_and_do_FLR(config) @@ -708,6 +723,8 @@ class XendDomainInfo: the device. """ + self.iommu_check_pod_mode() + # Test whether the devices can be assigned pci_name = pci_dict_to_bdf_str(new_dev) -- 2.39.5