Skip to content

Commit

Permalink
network_xml:Update to support setting up hostname xmls with a list of
Browse files Browse the repository at this point in the history
hostname strings

Then we can directly use the values getting from a netxml.hostnames to set
the value of netxml.hostnames without having to convert it from a list
of dicts to a list of strings.

Signed-off-by: Haijiao Zhao <[email protected]>
  • Loading branch information
chloerh committed Dec 5, 2024
1 parent 5ca5488 commit 0945504
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions virttest/libvirt_xml/network_xml.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,9 +291,12 @@ def marshal_from_hostname(item, index, libvirtxml):
"""
if isinstance(item, DNSXML.HostnameXML):
return "hostname", item
elif isinstance(item, str):
elif isinstance(item, (dict, str)):
hostname = DNSXML.HostnameXML()
hostname.hostname = item
if isinstance(item, dict):
hostname.setup_attrs(**item)
else:
hostname.hostname = item
return "hostname", hostname
else:
raise xcepts.LibvirtXMLError(
Expand Down

0 comments on commit 0945504

Please sign in to comment.