提交 121c9a86 编写于 作者: H Haijiao Zhao

Add attr 'port' to Interface class

- Add d dict type attr of Interface
- Update function modify_vm_iface() to support newly added attr
Signed-off-by: NHaijiao Zhao <haizhao@redhat.com>
上级 a16d6a26
......@@ -15,7 +15,7 @@ class Interface(base.TypedDeviceBase):
__slots__ = ('source', 'hostdev_address', 'managed', 'mac_address',
'bandwidth', 'model', 'coalesce', 'link_state', 'target', 'driver',
'address', 'boot', 'rom', 'mtu', 'filterref', 'backend',
'virtualport_type', 'alias', "ips", "teaming", "vlan")
'virtualport_type', 'alias', "ips", "teaming", "vlan", "port")
def __init__(self, type_name, virsh_instance=base.base.virsh):
super(Interface, self).__init__(device_tag='interface',
......@@ -128,6 +128,11 @@ class Interface(base.TypedDeviceBase):
subclass=self.Vlan,
subclass_dargs={
'virsh_instance': virsh_instance})
accessors.XMLElementDict(property_name='port',
libvirtxml=self,
forbidden=None,
parent_xpath='/',
tag_name='port')
# For convenience
Address = librarian.get('address')
......
......@@ -3434,9 +3434,11 @@ def modify_vm_iface(vm_name, oper, iface_dict, index=0):
iface_teaming = iface_dict.get('teaming')
iface_virtualport_type = iface_dict.get('virtualport_type')
iface_filter_parameters = iface_dict.get('filter_parameters')
iface_port = iface_dict.get('port')
del_addr = iface_dict.get('del_addr')
del_rom = iface_dict.get('del_rom')
del_filter = iface_dict.get('del_filter')
del_port = iface_dict.get('del_port')
if iface_type:
iface.type_name = iface_type
if iface_driver:
......@@ -3467,6 +3469,8 @@ def modify_vm_iface(vm_name, oper, iface_dict, index=0):
iface.del_address()
if del_filter:
iface.del_filterref()
if del_port:
iface.del_port()
if iface_filter:
if iface_filter_parameters:
iface.filterref = iface.new_filterref(name=iface_filter, parameters=iface_filter_parameters)
......@@ -3486,6 +3490,8 @@ def modify_vm_iface(vm_name, oper, iface_dict, index=0):
iface.teaming = eval(iface_teaming)
if iface_virtualport_type:
iface.virtualport_type = iface_virtualport_type
if iface_port:
iface.port = eval(iface_port)
if oper == "update_iface":
vmxml.devices = xml_devices
vmxml.xmltreefile.write()
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册