本文整理汇总了Python中virttest.libvirt_xml.devices.controller.Controller.node方法的典型用法代码示例。如果您正苦于以下问题:Python Controller.node方法的具体用法?Python Controller.node怎么用?Python Controller.node使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类virttest.libvirt_xml.devices.controller.Controller
的用法示例。
在下文中一共展示了Controller.node方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setup_controller
# 需要导入模块: from virttest.libvirt_xml.devices.controller import Controller [as 别名]
# 或者: from virttest.libvirt_xml.devices.controller.Controller import node [as 别名]
def setup_controller(nic_num, controller_index, ctl_models):
"""
Create controllers bond to numa node in the guest xml
:param nic_num: number of nic card bond to numa node
:param controller_index: index num used to create controllers
:param ctl_models: contoller topo for numa bond
"""
index = controller_index
if nic_num == 2:
ctl_models.append('pcie-switch-upstream-port')
ctl_models.append('pcie-switch-downstream-port')
ctl_models.append('pcie-switch-downstream-port')
for i in range(index):
controller = Controller("controller")
controller.type = "pci"
controller.index = i
if i == 0:
controller.model = 'pcie-root'
else:
controller.model = 'pcie-root-port'
vmxml.add_device(controller)
set_address = False
for model in ctl_models:
controller = Controller("controller")
controller.type = "pci"
controller.index = index
controller.model = model
if set_address or model == "pcie-switch-upstream-port":
attrs = {'type': 'pci', 'domain': '0', 'slot': '0',
'bus': index - 1, 'function': '0'}
controller.address = controller.new_controller_address(**{"attrs": attrs})
logging.debug(controller)
if controller.model == "pcie-expander-bus":
controller.node = "0"
controller.target = {'busNr': '100'}
set_address = True
else:
set_address = False
logging.debug(controller)
vmxml.add_device(controller)
index += 1
return index - 1