Add random MAC to CONTEXT

Hi,

I’d like to add the HWADDR parameter in the network script.

My template definition:
NIC = [ NETWORK = “blue”, IP = 192.168.2.3]
NIC = [ NETWORK = “interconnect”, IP = 192.168.100.3]

CONTEXT = [
NETWORK = “YES”,
BLUE_IP = “$NIC[IP, NETWORK=“blue”]”,
INTERCONNECT_IP = “$NIC[IP, NETWORK=“interconnect”]”,
INTERCONNECT_MAC = “$NIC[MAC, NETWORK=“interconnect”]”,
SET_HOSTNAME = “$NAME”,
DOMAIN=“vdicube.com
]

Anybody knows how can I add it when the mac address is generated randomly by the system?

Thanks a lot.

Hi oscar!
I maybe wrong but the CONTEXT looks fine to me, your INTERCONNECT_MAC should get the MAC address value for your NETWORK interconnect once the VM gets instantiated from the VM template, at that moment the MAC address will be generated randomly.

In any case, I assume that you’re preparing your own contextualization script so it can use that BLUE_IP, INTERCONNECT_IP variables aren’t you? but do you know that if you use the contextualization scripts shipped by OpenNebula your IP, MAC, Gateway… would be set automatically as ETHX_ variables are added automatically to the context section if you set NETWORK=YES

Cheers!