WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-users

Re: [Xen-users] uniq mac address generator

To: trilok nuwal <tc.nuwal@xxxxxxxxx>
Subject: Re: [Xen-users] uniq mac address generator
From: Timo Benk <timo.benk@xxxxxx>
Date: Fri, 13 Apr 2007 15:33:58 +0200
Cc: "Petersson, Mats" <Mats.Petersson@xxxxxxx>, Xen list <Xen-users@xxxxxxxxxxxxxxxxxxx>
Delivery-date: Fri, 13 Apr 2007 06:34:29 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
In-reply-to: <f58fc26d0704130626n42ea7f5fn229d0e6fd0ce565d@xxxxxxxxxxxxxx>
List-help: <mailto:xen-users-request@lists.xensource.com?subject=help>
List-id: Xen user discussion <xen-users.lists.xensource.com>
List-post: <mailto:xen-users@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-users>, <mailto:xen-users-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-users>, <mailto:xen-users-request@lists.xensource.com?subject=unsubscribe>
References: <f58fc26d0704130626n42ea7f5fn229d0e6fd0ce565d@xxxxxxxxxxxxxx>
Sender: xen-users-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: RoundCube Webmail/0.1b
Hi,

> But How i can insure that mac geneareted by this script will
> be uniq in whole world. Some body in the same network also
> might use the same script
> and can get the same  mac as i am .

You can add a little python to your config files. That way
you can bind the MAC to the vmid parameter. The vmid
code is directly extracted off the example configuration.

---<snip>---
# This function checks that 'vmid' has been given a valid value.
# It is called automatically by 'xm create'.
def vmid_check(var, val):
    val = int(val)
    if val <= 0:
        raise ValueError
    return val

# Define the 'vmid' variable so that 'xm create' knows about it.
xm_vars.var('vmid',
            use="Virtual machine id. Integer greater than 0.",
            check=vmid_check)

# Check the defined variables have valid values..
xm_vars.check()


# One virtual interface
vif = [ 'mac=00:11:25:67:30:%0.2x,rate=1024B/s' % vmid ]
---<snip>---

Greetings,
-timo
-- 
Timo Benk - Jabber ID: fry@xxxxxxxxxxxx - ICQ ID: #414944731
PGP Public Key: http://www.m28s01.vlinux.de/timo_benk_gpg_key.asc



_______________________________________________
Xen-users mailing list
Xen-users@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-users