Skip to content

Commit

Permalink
Merge pull request #3362 from Yingshun/hostdev_address_rom
Browse files Browse the repository at this point in the history
Support address and rom for hostdev
  • Loading branch information
dzhengfy committed Apr 13, 2022
2 parents 54c8ff1 + fdb0f49 commit 690054f
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions virttest/libvirt_xml/devices/hostdev.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,16 @@
http://libvirt.org/formatdomain.html#elementsHostDev
"""
from virttest.libvirt_xml.devices import base
from virttest.libvirt_xml import accessors
from virttest.libvirt_xml.devices import base
from virttest.libvirt_xml.devices import librarian


class Hostdev(base.TypedDeviceBase):

__slots__ = ('type', 'mode', 'managed', 'sgio', 'rawio',
'source', 'boot_order', 'readonly', 'shareable',
'alias', 'model', 'teaming')
'alias', 'model', 'teaming', 'rom', 'address')

def __init__(self, type_name="hostdev", virsh_instance=base.base.virsh):
accessors.XMLAttribute('type', self, parent_xpath='/',
Expand All @@ -38,12 +39,20 @@ def __init__(self, type_name="hostdev", virsh_instance=base.base.virsh):
tag_name='shareable')
accessors.XMLElementDict('alias', self, parent_xpath='/',
tag_name='alias')
accessors.XMLElementDict('rom', self, parent_xpath='/',
tag_name='rom')
accessors.XMLElementNest('address', self, parent_xpath='/',
tag_name='address', subclass=self.Address,
subclass_dargs={'type_name': 'drive',
'virsh_instance': virsh_instance})
accessors.XMLElementDict("teaming", self, parent_xpath='/',
tag_name='teaming')
super(self.__class__, self).__init__(device_tag='hostdev',
type_name=type_name,
virsh_instance=virsh_instance)

Address = librarian.get('address')

def new_source(self, **dargs):
new_one = self.Source(virsh_instance=self.virsh)
if self.type == 'pci':
Expand Down

0 comments on commit 690054f

Please sign in to comment.