Example #1
0
 def create_hostdev_interface(pci_id, managed, model):
     """
         Create hostdev type interface xml.
     """
     attrs = create_address_dict(pci_id)
     new_iface = Interface('hostdev')
     new_iface.managed = managed
     if model != "":
         new_iface.model = model
     new_iface.mac_address = utils_net.generate_mac_address_simple()
     new_iface.hostdev_address = new_iface.new_iface_address(
         **{"attrs": attrs})
     return new_iface
Example #2
0
 def create_hostdev_interface(pci_id, managed, model):
     """
         Create hostdev type interface xml.
     """
     attrs = create_address_dict(pci_id)
     new_iface = Interface('hostdev')
     new_iface.managed = managed
     if model != "":
         new_iface.model = model
     new_iface.mac_address = utils_net.generate_mac_address_simple()
     new_iface.hostdev_address = new_iface.new_iface_address(**{"attrs": attrs})
     chars = string.ascii_letters + string.digits + '-_'
     alias_name = 'ua-' + ''.join(random.choice(chars) for _ in list(range(64)))
     new_iface.alias = {'name': alias_name}
     return new_iface