Cannot get IP/MAC lease from virtual network

Hi,

I created an OVS network providing MAC addresses from an Ethernet pool:

onevnet show 4
VIRTUAL NETWORK 4 INFORMATION
ID : 4
NAME : MWN_access_1
USER : cloudmaster
GROUP : users
CLUSTER : Production
BRIDGE : br2254
VLAN : No
USED LEASES : 2

PERMISSIONS
OWNER : um-
GROUP : u–
OTHER : —

VIRTUAL NETWORK TEMPLATE
BRIDGE=“br2254"
PHYDEV=”“
VLAN=“NO"
VLAN_ID=””

ADDRESS RANGE POOL
AR TYPE SIZE LEASES MAC IP GLOBAL_PREFIX
1 ETHER 128 2 02:00:00:01:00:00 - -

LEASES
AR OWNER MAC IP IP6_GLOBAL
1 VM : 5336 02:00:00:01:00:00 - -
1 VM : -1 02:00:00:01:00:04

Is it possible to assign a specific MAC to a VM?
I tried something like

onevm nic-attach 5562 -n MWN_access_1 -i 02:00:00:01:00:04

but I keep receiving the following error message
[VirtualMachineAttachNic] Cannot get IP/MAC lease from virtual network 4.

I’m using OpenNebula 4.8.

Thanks,

Matteo

Actually, with some more digging, I found out that the question is a bit silly and the solution straightforward:

  • I used a reservation rather than holding an entry of the address range
  • instead of passing the MAC address via the command line option I created a template file for the NIC to attach and passed it to onevm nic-attach. Something along the lines

NIC = [
NETWORK_ID = 4,
MODEL = “virtio”,
MAC = “02:00:00:01:00:04” ]

will do the trick.

I hope it’ll be useful for someone else.