def is_conflict_net(self, conn, mac=None): """ is_conflict_net: determines if mac conflicts with others in system returns a two element tuple: first element is True if fatal collision occured second element is a string description of the collision. Non fatal collisions (mac addr collides with inactive guest) will return (False, "description of collision") """ mac = mac or self.macaddr if mac is None: return (False, None) vms, inactive_vm = _util.fetch_all_guests(conn) # get the Host's NIC MAC address hostdevs = [] if not self.is_remote(): hostdevs = _util.get_host_network_devices() if (_countMACaddr(vms, mac) > 0 or _countMACaddr(inactive_vm, mac) > 0): return (True, _("The MAC address you entered is already in use " "by another virtual machine.")) for dev in hostdevs: host_macaddr = dev[4] if mac.upper() == host_macaddr.upper(): return (True, _("The MAC address you entered conflicts with " "a device on the physical host.")) return (False, None)
def is_conflict_net(self, conn): """is_conflict_net: determines if mac conflicts with others in system returns a two element tuple: first element is True if fatal collision occured second element is a string description of the collision. Non fatal collisions (mac addr collides with inactive guest) will return (False, "description of collision")""" if self.macaddr is None: return (False, None) vms, inactive_vm = _util.fetch_all_guests(conn) # get the Host's NIC MACaddress hostdevs = _util.get_host_network_devices() if self.countMACaddr(vms) > 0: return ( True, _("The MAC address you entered is already in use by another active virtual machine." )) for (dummy, dummy, dummy, dummy, host_macaddr) in hostdevs: if self.macaddr.upper() == host_macaddr.upper(): return ( True, _("The MAC address you entered conflicts with a device on the physical host." )) if self.countMACaddr(inactive_vm) > 0: return ( False, _("The MAC address you entered is already in use by another inactive virtual machine." )) return (False, None)
def is_conflict_net(self, conn, mac=None): """ is_conflict_net: determines if mac conflicts with others in system returns a two element tuple: first element is True if fatal collision occured second element is a string description of the collision. Non fatal collisions (mac addr collides with inactive guest) will return (False, "description of collision") """ mac = mac or self.macaddr if mac is None: return (False, None) # Not supported for remote connections yet if self.is_remote(): return (False, None) vms, inactive_vm = _util.fetch_all_guests(conn) # get the Host's NIC MACaddress hostdevs = _util.get_host_network_devices() if _countMACaddr(vms, mac) > 0: return (True, _("The MAC address you entered is already in use " "by another active virtual machine.")) for dev in hostdevs: host_macaddr = dev[4] if mac.upper() == host_macaddr.upper(): return (True, _("The MAC address you entered conflicts with " "a device on the physical host.")) if _countMACaddr(inactive_vm, mac) > 0: return (False, _("The MAC address you entered is already in use " "by another inactive virtual machine.")) return (False, None)
def is_conflict_net(self, conn): """is_conflict_net: determines if mac conflicts with others in system returns a two element tuple: first element is True if fatal collision occured second element is a string description of the collision. Non fatal collisions (mac addr collides with inactive guest) will return (False, "description of collision")""" if self.macaddr is None: return (False, None) vms, inactive_vm = _util.fetch_all_guests(conn) # get the Host's NIC MACaddress hostdevs = _util.get_host_network_devices() if self.countMACaddr(vms) > 0: return (True, _("The MAC address you entered is already in use by another active virtual machine.")) for (dummy, dummy, dummy, dummy, host_macaddr) in hostdevs: if self.macaddr.upper() == host_macaddr.upper(): return (True, _("The MAC address you entered conflicts with a device on the physical host.")) if self.countMACaddr(inactive_vm) > 0: return (False, _("The MAC address you entered is already in use by another inactive virtual machine.")) return (False, None)