Ejemplo n.º 1
0
    def change_mac_finish(self, ignore):
        orig = self.widget("change-mac-orig").get_text()
        new = self.widget("change-mac-new").get_text()
        row = self.net_list[orig]

        try:
            ignore, msg = VirtualNetworkInterface.is_conflict_net(
                                self.conn.get_backend(), new)
            if msg:
                raise RuntimeError(msg)
            row[NETWORK_INFO_NEW_MAC] = new
        except Exception, e:
            self.err.show_err(_("Error changing MAC address: %s") % str(e))
            return
Ejemplo n.º 2
0
    def change_mac_finish(self, ignore):
        orig = self.widget("change-mac-orig").get_text()
        new = self.widget("change-mac-new").get_text()
        row = self.net_list[orig]

        try:
            ignore, msg = VirtualNetworkInterface.is_conflict_net(
                self.conn.get_backend(), new)
            if msg:
                raise RuntimeError(msg)
            row[NETWORK_INFO_NEW_MAC] = new
        except Exception, e:
            self.err.show_err(_("Error changing MAC address: %s") % str(e))
            return
Ejemplo n.º 3
0
        net = VirtualNetworkInterface(conn=conn.vmm,
                                      type=nettype,
                                      bridge=bridge,
                                      network=netname,
                                      macaddr=macaddr,
                                      model=model)
        if net.model == "spapr-vlan":
            addr = "spapr-vio"

        net.set_address(addr)

    except Exception, e:
        return err_dial.val_err(_("Error with network parameters."), e)

    # Make sure there is no mac address collision
    isfatal, errmsg = net.is_conflict_net(conn.vmm)
    if isfatal:
        return err_dial.val_err(_("Mac address collision."), errmsg)
    elif errmsg is not None:
        retv = err_dial.yes_no(_("Mac address collision."),
                               _("%s Are you sure you want to use this "
                                 "address?") % errmsg)
        if not retv:
            return False

    return net

def generate_macaddr(conn):
    newmac = ""
    try:
        net = VirtualNetworkInterface(conn=conn.vmm)