diff --git a/virttest/libvirt_xml/network_xml.py b/virttest/libvirt_xml/network_xml.py index 581074f649..3f8cc9e30e 100644 --- a/virttest/libvirt_xml/network_xml.py +++ b/virttest/libvirt_xml/network_xml.py @@ -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(