VMware ESXi 5.5 + vsphere: Mac Value is blank

Hi,

I've read many things about vmware compute ressource:

Better VMware support for non-clustered setup
: Feature #1945: Better VMWare support for non-clusters setup - Foreman

and all attached bugs, but there is still something not clear:

In Vmware ESXi 5.5 and vsphere, mac address is created when the VM boot for
the first time, so obviously foreman can't retrieve the mac parameter from
ESX.

So does that mean manage and provision compute ressource on this kind of
setup will never work ?

Regards,

Hello ! MAC address is created when VM is created, not booting. So foreman
get the information back before powering on and booting the VM.

> Hi,
>
> I've read many things about vmware compute ressource:
>
> Better VMware support for non-clustered setup :
> Feature #1945: Better VMWare support for non-clusters setup - Foreman
>
> and all attached bugs, but there is still something not clear:
>
> In Vmware ESXi 5.5 and vsphere, mac address is created when the VM boot
> for the first time, so obviously foreman can't retrieve the mac parameter
> from ESX.
>
> So does that mean manage and provision compute ressource on this kind of
> setup will never work ?
>

Any hints on this ?

··· 2015-01-29 11:53 GMT+01:00 claude juif :

Regards,


You received this message because you are subscribed to the Google Groups
"Foreman users" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to foreman-users+unsubscribe@googlegroups.com.
To post to this group, send email to foreman-users@googlegroups.com.
Visit this group at http://groups.google.com/group/foreman-users.
For more options, visit https://groups.google.com/d/optout.

No, you can read this : Bug #8528: Provisioning on a non-clustered ESXi - Foreman

I've also tried in vsphere, creating a new VM, as long as you don't boot
the VM, you have no mac address assigned to the network card. The mac
address field in the VM property is grayed out, but i can still select
manual and specify a mac address manually.

So maybe there is a way to specify a mac adress in foreman which will be
set when foreman create the VM.

I wonder if foreman can workaround this, or if this is an EXSi limitations.

Regards,

··· Le jeudi 29 janvier 2015 12:24:57 UTC+1, Alexandre Barth a écrit : > > Hello ! MAC address is created when VM is created, not booting. So foreman > get the information back before powering on and booting the VM. >

> Hello ! MAC address is created when VM is created, not booting. So foreman
> get the information back before powering on and booting the VM.
>

Dis that work for you ? here is my setup :

VmWare ESXi 5.5.0 Build 1331820
Vsphere Client 5.5.0 Build 1281650
Foreman 1.7.2 on Debian 7.8 (Wheezy)

Do you need to give a special setup in ESX for mac address to be generated
on vm creation ?

··· 2015-01-29 12:24 GMT+01:00 Alexandre Barth :


You received this message because you are subscribed to the Google Groups
"Foreman users" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to foreman-users+unsubscribe@googlegroups.com.
To post to this group, send email to foreman-users@googlegroups.com.
Visit this group at http://groups.google.com/group/foreman-users.
For more options, visit https://groups.google.com/d/optout.

After digging a bit this issue,

I found that ESXi does not provide mac address at creation time. I just
created a vm with vsphere client, and check the vmx file. What i get is :

ethernet0.virtualDev = "e1000"
ethernet0.networkName = "Vlan xxx"
ethernet0.addressType = "generated"
ethernet0.present = "TRUE"

So i have no mac address for the VM at that time.

Il i boot the VM and check the vmx file again, i get this line :

ethernet0.generatedAddress = "xx:xx:xx:xx:xx:xx"

So mac address is generated at boot time.

Is there any way i can specify a mac address manually ?

I see in the fog library, that the "generated" parameter for mac address
is hardcoded.

We can also set it to manually, and adapt foreman UI so i can provide a mac
address by hand.

I'm not so comfortable with ruby, but i can do my best to fix this. Do you
have any pointer for where i should start to fix this ?

Regards,

··· 2015-02-02 12:23 GMT+01:00 claude juif :

2015-01-29 11:53 GMT+01:00 claude juif claude.juif@gmail.com:

Hi,

I’ve read many things about vmware compute ressource:

Better VMware support for non-clustered setup :
Feature #1945: Better VMWare support for non-clusters setup - Foreman

and all attached bugs, but there is still something not clear:

In Vmware ESXi 5.5 and vsphere, mac address is created when the VM boot
for the first time, so obviously foreman can’t retrieve the mac parameter
from ESX.

So does that mean manage and provision compute ressource on this kind of
setup will never work ?

Any hints on this ?

Regards,


You received this message because you are subscribed to the Google Groups
"Foreman users" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to foreman-users+unsubscribe@googlegroups.com.
To post to this group, send email to foreman-users@googlegroups.com.
Visit this group at http://groups.google.com/group/foreman-users.
For more options, visit https://groups.google.com/d/optout.

I have no provisioning problem using Foreman 1.7.2 and vSphere 5.5 (with
vCenter Server). MAC adresses are correctly retrieved on host creation
without using any particular configuration.

··· Le jeudi 29 janvier 2015 12:55:36 UTC+1, claude juif a écrit : > > > > 2015-01-29 12:24 GMT+01:00 Alexandre Barth >: > >> Hello ! MAC address is created when VM is created, not booting. So >> foreman get the information back before powering on and booting the VM. >> > > Dis that work for you ? here is my setup : > > VmWare ESXi 5.5.0 Build 1331820 > Vsphere Client 5.5.0 Build 1281650 > Foreman 1.7.2 on Debian 7.8 (Wheezy) > > Do you need to give a special setup in ESX for mac address to be generated > on vm creation ? > >> -- >> You received this message because you are subscribed to the Google Groups >> "Foreman users" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to foreman-user...@googlegroups.com . >> To post to this group, send email to forema...@googlegroups.com >> . >> Visit this group at http://groups.google.com/group/foreman-users. >> For more options, visit https://groups.google.com/d/optout. >> > >

>
> I have no provisioning problem using Foreman 1.7.2 and vSphere 5.5 (with
> vCenter Server). MAC adresses are correctly retrieved on host creation
> without using any particular configuration.
>

Ok I don't have vCenter Server, so maybe that's why :wink:

But foreman is unable to retrieve mac address of newly created VM.

The VM is correctly created with my parameters( i can see all my datastore,
and all my network adapter), but VM is deleted right after because he can't
retrieve mac address.

I have no log in Vmware about what is going wrong, Just message like :
Searching entity by UUID 4 or 5 times.

It seems i'm not alone facing this problem. ticket
Bug #8528: Provisioning on a non-clustered ESXi - Foreman ending with foreman 1.8.0 (maybe
will be fixed in next release)

Somebody have any clue about this ? (Not sure if this is on foreman or on
ESX)

··· Le jeudi 29 janvier 2015 14:32:08 UTC+1, Alexandre Barth a écrit :

Le jeudi 29 janvier 2015 12:55:36 UTC+1, claude juif a écrit :

2015-01-29 12:24 GMT+01:00 Alexandre Barth alexandr...@gmail.com:

Hello ! MAC address is created when VM is created, not booting. So
foreman get the information back before powering on and booting the VM.

Dis that work for you ? here is my setup :

VmWare ESXi 5.5.0 Build 1331820
Vsphere Client 5.5.0 Build 1281650
Foreman 1.7.2 on Debian 7.8 (Wheezy)

Do you need to give a special setup in ESX for mac address to be
generated on vm creation ?


You received this message because you are subscribed to the Google
Groups “Foreman users” group.
To unsubscribe from this group and stop receiving emails from it, send
an email to foreman-user...@googlegroups.com.
To post to this group, send email to forema...@googlegroups.com.
Visit this group at http://groups.google.com/group/foreman-users.
For more options, visit https://groups.google.com/d/optout.

Alexandre,

Are you provisioning using VMware templates and VDS's? I cant get it
working, have a bug filed here:

http://projects.theforeman.org/issues/7740

··· On Thursday, January 29, 2015 at 8:32:08 AM UTC-5, Alexandre Barth wrote: > > I have no provisioning problem using Foreman 1.7.2 and vSphere 5.5 (with > vCenter Server). MAC adresses are correctly retrieved on host creation > without using any particular configuration. > > Le jeudi 29 janvier 2015 12:55:36 UTC+1, claude juif a écrit : >> >> >> >> 2015-01-29 12:24 GMT+01:00 Alexandre Barth : >> >>> Hello ! MAC address is created when VM is created, not booting. So >>> foreman get the information back before powering on and booting the VM. >>> >> >> Dis that work for you ? here is my setup : >> >> VmWare ESXi 5.5.0 Build 1331820 >> Vsphere Client 5.5.0 Build 1281650 >> Foreman 1.7.2 on Debian 7.8 (Wheezy) >> >> Do you need to give a special setup in ESX for mac address to be >> generated on vm creation ? >> >>> -- >>> You received this message because you are subscribed to the Google >>> Groups "Foreman users" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to foreman-user...@googlegroups.com. >>> To post to this group, send email to forema...@googlegroups.com. >>> Visit this group at http://groups.google.com/group/foreman-users. >>> For more options, visit https://groups.google.com/d/optout. >>> >> >>

The following is a hack that worked for me…
I struggled a bit generating valid mac addresses that would work with DHCP
(toggling the correct bits in the first octet).
In the end, you can see I've just set the first octet to 0x00

Enjoy.

— create_vm.rb.orig 2015-02-08 21:00:00.649826556 +0000
+++ create_vm.rb 2015-02-08 21:00:35.615826533 +0000
@@ -77,10 +77,18 @@
:summary => nic.summary,
},
:backing => create_nic_backing(nic, attributes),

  •          :addressType => 'generated')
    
  •          :addressType => 'Manual',
    
  •          :macAddress => randommac())
         }
       end
    
  •    def randommac()
    
  •      mac_octets = (1..6).collect { rand(256) }
    
  •      mac_octets[0] = 0x00
    
  •      format = '%02X'
    
  •      mac_octets.collect { |i| format % [i] }.join(':')
    
  •    end
    
··· On Thursday, 5 February 2015 11:42:14 UTC, claude juif wrote: > > After digging a bit this issue, > > I found that ESXi does not provide mac address at creation time. I just > created a vm with vsphere client, and check the vmx file. What i get is : > > ethernet0.virtualDev = "e1000" > ethernet0.networkName = "Vlan xxx" > ethernet0.addressType = "generated" > ethernet0.present = "TRUE" > > So i have no mac address for the VM at that time. > > Il i boot the VM and check the vmx file again, i get this line : > > ethernet0.generatedAddress = "xx:xx:xx:xx:xx:xx" > > So mac address is generated at boot time. > > Is there any way i can specify a mac address manually ? > > I see in the fog library, that the "generated" parameter for mac address > is hardcoded. > > We can also set it to manually, and adapt foreman UI so i can provide a > mac address by hand. > > I'm not so comfortable with ruby, but i can do my best to fix this. Do you > have any pointer for where i should start to fix this ? > > Regards, > > 2015-02-02 12:23 GMT+01:00 claude juif <claud...@gmail.com >: > >> >> 2015-01-29 11:53 GMT+01:00 claude juif <claud...@gmail.com > >> : >> >>> Hi, >>> >>> I've read many things about vmware compute ressource: >>> >>> Better VMware support for non-clustered setup : >>> http://projects.theforeman.org/issues/1945 >>> >>> and all attached bugs, but there is still something not clear: >>> >>> In Vmware ESXi 5.5 and vsphere, mac address is created when the VM boot >>> for the first time, so obviously foreman can't retrieve the mac parameter >>> from ESX. >>> >>> So does that mean manage and provision compute ressource on this kind of >>> setup will never work ? >>> >> >> Any hints on this ? >> > + def create_controller options=nil options=if options

controller_default_options.merge(Hash[options.map{|k,v| [k.to_sym,v] }])

No sorry, i don't currently use VDS with vSphere and i only provision using
PXE boot + TFTP.

··· Le jeudi 29 janvier 2015 22:46:20 UTC+1, Friedrich Seifts a écrit : > > Alexandre, > > Are you provisioning using VMware templates and VDS's? I cant get it > working, have a bug filed here: > > http://projects.theforeman.org/issues/7740 > > On Thursday, January 29, 2015 at 8:32:08 AM UTC-5, Alexandre Barth wrote: >> >> I have no provisioning problem using Foreman 1.7.2 and vSphere 5.5 (with >> vCenter Server). MAC adresses are correctly retrieved on host creation >> without using any particular configuration. >> >> Le jeudi 29 janvier 2015 12:55:36 UTC+1, claude juif a écrit : >>> >>> >>> >>> 2015-01-29 12:24 GMT+01:00 Alexandre Barth : >>> >>>> Hello ! MAC address is created when VM is created, not booting. So >>>> foreman get the information back before powering on and booting the VM. >>>> >>> >>> Dis that work for you ? here is my setup : >>> >>> VmWare ESXi 5.5.0 Build 1331820 >>> Vsphere Client 5.5.0 Build 1281650 >>> Foreman 1.7.2 on Debian 7.8 (Wheezy) >>> >>> Do you need to give a special setup in ESX for mac address to be >>> generated on vm creation ? >>> >>>> -- >>>> You received this message because you are subscribed to the Google >>>> Groups "Foreman users" group. >>>> To unsubscribe from this group and stop receiving emails from it, send >>>> an email to foreman-user...@googlegroups.com. >>>> To post to this group, send email to forema...@googlegroups.com. >>>> Visit this group at http://groups.google.com/group/foreman-users. >>>> For more options, visit https://groups.google.com/d/optout. >>>> >>> >>>

Hi Alexander,

··· 2015-02-08 22:04 GMT+01:00 Alexander Fisher :

On Thursday, 5 February 2015 11:42:14 UTC, claude juif wrote:

After digging a bit this issue,

I found that ESXi does not provide mac address at creation time. I just
created a vm with vsphere client, and check the vmx file. What i get is :

ethernet0.virtualDev = "e1000"
ethernet0.networkName = "Vlan xxx"
ethernet0.addressType = "generated"
ethernet0.present = “TRUE”

So i have no mac address for the VM at that time.

Il i boot the VM and check the vmx file again, i get this line :

ethernet0.generatedAddress = “xx:xx:xx:xx:xx:xx”

So mac address is generated at boot time.

Is there any way i can specify a mac address manually ?

I see in the fog library, that the “generated” parameter for mac address
is hardcoded.

We can also set it to manually, and adapt foreman UI so i can provide a
mac address by hand.

I’m not so comfortable with ruby, but i can do my best to fix this. Do
you have any pointer for where i should start to fix this ?

Regards,

2015-02-02 12:23 GMT+01:00 claude juif claud...@gmail.com:

2015-01-29 11:53 GMT+01:00 claude juif claud...@gmail.com:

Hi,

I’ve read many things about vmware compute ressource:

Better VMware support for non-clustered setup :
Feature #1945: Better VMWare support for non-clusters setup - Foreman

and all attached bugs, but there is still something not clear:

In Vmware ESXi 5.5 and vsphere, mac address is created when the VM boot
for the first time, so obviously foreman can’t retrieve the mac parameter
from ESX.

So does that mean manage and provision compute ressource on this kind
of setup will never work ?

Any hints on this ?

The following is a hack that worked for me…
I struggled a bit generating valid mac addresses that would work with DHCP
(toggling the correct bits in the first octet).
In the end, you can see I’ve just set the first octet to 0x00

Enjoy.

— create_vm.rb.orig 2015-02-08 21:00:00.649826556 +0000
+++ create_vm.rb 2015-02-08 21:00:35.615826533 +0000
@@ -77,10 +77,18 @@
:summary => nic.summary,
},
:backing => create_nic_backing(nic, attributes),

  •          :addressType => 'generated')
    
  •          :addressType => 'Manual',
    
  •          :macAddress => randommac())
         }
       end
    
  •    def randommac()
    
  •      mac_octets = (1..6).collect { rand(256) }
    
  •      mac_octets[0] = 0x00
    
  •      format = '%02X'
    
  •      mac_octets.collect { |i| format % [i] }.join(':')
    
  •    end
    
  •    def create_controller options=nil
         options=if options
    

controller_default_options.merge(Hash[options.map{|k,v| [k.to_sym,v] }])

It works. Thanks so much

(tested on foreman 1.7.2)

Foreman folks, can you consider implementing this features on next foreman
release ?

You received this message because you are subscribed to the Google Groups
"Foreman users" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to foreman-users+unsubscribe@googlegroups.com.
To post to this group, send email to foreman-users@googlegroups.com.
Visit this group at http://groups.google.com/group/foreman-users.
For more options, visit https://groups.google.com/d/optout.

Great, Thanks Much Alex.

··· On Sunday, February 8, 2015 at 3:04:09 PM UTC-6, Alexander Fisher wrote: > > On Thursday, 5 February 2015 11:42:14 UTC, claude juif wrote: >> >> After digging a bit this issue, >> >> I found that ESXi does not provide mac address at creation time. I just >> created a vm with vsphere client, and check the vmx file. What i get is : >> >> ethernet0.virtualDev = "e1000" >> ethernet0.networkName = "Vlan xxx" >> ethernet0.addressType = "generated" >> ethernet0.present = "TRUE" >> >> So i have no mac address for the VM at that time. >> >> Il i boot the VM and check the vmx file again, i get this line : >> >> ethernet0.generatedAddress = "xx:xx:xx:xx:xx:xx" >> >> So mac address is generated at boot time. >> >> Is there any way i can specify a mac address manually ? >> >> I see in the fog library, that the "generated" parameter for mac address >> is hardcoded. >> >> We can also set it to manually, and adapt foreman UI so i can provide a >> mac address by hand. >> >> I'm not so comfortable with ruby, but i can do my best to fix this. Do >> you have any pointer for where i should start to fix this ? >> >> Regards, >> >> 2015-02-02 12:23 GMT+01:00 claude juif : >> >>> >>> 2015-01-29 11:53 GMT+01:00 claude juif : >>> >>>> Hi, >>>> >>>> I've read many things about vmware compute ressource: >>>> >>>> Better VMware support for non-clustered setup : >>>> http://projects.theforeman.org/issues/1945 >>>> >>>> and all attached bugs, but there is still something not clear: >>>> >>>> In Vmware ESXi 5.5 and vsphere, mac address is created when the VM boot >>>> for the first time, so obviously foreman can't retrieve the mac parameter >>>> from ESX. >>>> >>>> So does that mean manage and provision compute ressource on this kind >>>> of setup will never work ? >>>> >>> >>> Any hints on this ? >>> >> > The following is a hack that worked for me... > I struggled a bit generating valid mac addresses that would work with DHCP > (toggling the correct bits in the first octet). > In the end, you can see I've just set the first octet to 0x00 > > Enjoy. > > --- create_vm.rb.orig 2015-02-08 21:00:00.649826556 +0000 > +++ create_vm.rb 2015-02-08 21:00:35.615826533 +0000 > @@ -77,10 +77,18 @@ > :summary => nic.summary, > }, > :backing => create_nic_backing(nic, attributes), > - :addressType => 'generated') > + :addressType => 'Manual', > + :macAddress => randommac()) > } > end > > + def randommac() > + mac_octets = (1..6).collect { rand(256) } > + mac_octets[0] = 0x00 > + format = '%02X' > + mac_octets.collect { |i| format % [i] }.join(':') > + end > + > def create_controller options=nil > options=if options > > controller_default_options.merge(Hash[options.map{|k,v| [k.to_sym,v] }]) >

>
> Hi Alexander,
>
> 2015-02-08 22:04 GMT+01:00 Alexander Fisher <alexj...@gmail.com
> <javascript:>>:
>
>>>
>>> After digging a bit this issue,
>>>
>>> I found that ESXi does not provide mac address at creation time. I just
>>> created a vm with vsphere client, and check the vmx file. What i get is :
>>>
>>> ethernet0.virtualDev = "e1000"
>>> ethernet0.networkName = "Vlan xxx"
>>> ethernet0.addressType = "generated"
>>> ethernet0.present = "TRUE"
>>>
>>> So i have no mac address for the VM at that time.
>>>
>>> Il i boot the VM and check the vmx file again, i get this line :
>>>
>>> ethernet0.generatedAddress = "xx:xx:xx:xx:xx:xx"
>>>
>>> So mac address is generated at boot time.
>>>
>>> Is there any way i can specify a mac address manually ?
>>>
>>> I see in the fog library, that the "generated" parameter for mac
>>> address is hardcoded.
>>>
>>> We can also set it to manually, and adapt foreman UI so i can provide a
>>> mac address by hand.
>>>
>>> I'm not so comfortable with ruby, but i can do my best to fix this. Do
>>> you have any pointer for where i should start to fix this ?
>>>
>>> Regards,
>>>
>>>
>>>>
>>>>
>>>>> Hi,
>>>>>
>>>>> I've read many things about vmware compute ressource:
>>>>>
>>>>> Better VMware support for non-clustered setup :
>>>>> Feature #1945: Better VMWare support for non-clusters setup - Foreman
>>>>>
>>>>> and all attached bugs, but there is still something not clear:
>>>>>
>>>>> In Vmware ESXi 5.5 and vsphere, mac address is created when the VM
>>>>> boot for the first time, so obviously foreman can't retrieve the mac
>>>>> parameter from ESX.
>>>>>
>>>>> So does that mean manage and provision compute ressource on this kind
>>>>> of setup will never work ?
>>>>>
>>>>
>>>> Any hints on this ?
>>>>
>>>
>> The following is a hack that worked for me…
>> I struggled a bit generating valid mac addresses that would work with
>> DHCP (toggling the correct bits in the first octet).
>> In the end, you can see I've just set the first octet to 0x00
>>
>> Enjoy.
>>
>> — create_vm.rb.orig 2015-02-08 21:00:00.649826556 +0000
>> +++ create_vm.rb 2015-02-08 21:00:35.615826533 +0000
>> @@ -77,10 +77,18 @@
>> :summary => nic.summary,
>> },
>> :backing => create_nic_backing(nic, attributes),
>> - :addressType => 'generated')
>> + :addressType => 'Manual',
>> + :macAddress => randommac())
>> }
>> end
>>
>> + def randommac()
>> + mac_octets = (1…6).collect { rand(256) }
>> + mac_octets[0] = 0x00
>> + format = '%02X'
>> + mac_octets.collect { |i| format % [i] }.join(':')
>> + end
>> +
>> def create_controller options=nil
>> options=if options
>>
>> controller_default_options.merge(Hash[options.map{|k,v| [k.to_sym,v] }])
>>
>
> It works. Thanks so much
>

Great!

>
> (tested on foreman 1.7.2)
>
> Foreman folks, can you consider implementing this features on next foreman
> release ?
>

I guess using a mac generated by foreman would need to be conditional on
either an explicit option set by the user, or perhaps automatically if
connected to a vsphere hypervisor (and not vcenter).
For small deployments, generating random macs (40 bits are random in my
example), should be ok (the chances of a collision being quite small [1]).
Larger deployments would be using vcenter and wouldn't need this workaround?

[1]

··· On Monday, 9 February 2015 10:12:29 UTC, claude juif wrote: >> On Thursday, 5 February 2015 11:42:14 UTC, claude juif wrote: >>> 2015-02-02 12:23 GMT+01:00 claude juif : >>>> 2015-01-29 11:53 GMT+01:00 claude juif :

Just thought of one more thing… You've got a 1 in 65536 chance of
generating a mac address starting 00:50:56 (the vmware OUI), and IIRC
vmware will refuse it. Easy enough to check for this and generate another
mac if needed.

··· On Monday, 9 February 2015 10:37:30 UTC, Alexander Fisher wrote: > > On Monday, 9 February 2015 10:12:29 UTC, claude juif wrote: >> >> Hi Alexander, >> >> 2015-02-08 22:04 GMT+01:00 Alexander Fisher : >> >>> On Thursday, 5 February 2015 11:42:14 UTC, claude juif wrote: >>>> >>>> After digging a bit this issue, >>>> >>>> I found that ESXi does not provide mac address at creation time. I just >>>> created a vm with vsphere client, and check the vmx file. What i get is : >>>> >>>> ethernet0.virtualDev = "e1000" >>>> ethernet0.networkName = "Vlan xxx" >>>> ethernet0.addressType = "generated" >>>> ethernet0.present = "TRUE" >>>> >>>> So i have no mac address for the VM at that time. >>>> >>>> Il i boot the VM and check the vmx file again, i get this line : >>>> >>>> ethernet0.generatedAddress = "xx:xx:xx:xx:xx:xx" >>>> >>>> So mac address is generated at boot time. >>>> >>>> Is there any way i can specify a mac address manually ? >>>> >>>> I see in the fog library, that the "generated" parameter for mac >>>> address is hardcoded. >>>> >>>> We can also set it to manually, and adapt foreman UI so i can provide a >>>> mac address by hand. >>>> >>>> I'm not so comfortable with ruby, but i can do my best to fix this. Do >>>> you have any pointer for where i should start to fix this ? >>>> >>>> Regards, >>>> >>>> 2015-02-02 12:23 GMT+01:00 claude juif : >>>> >>>>> >>>>> 2015-01-29 11:53 GMT+01:00 claude juif : >>>>> >>>>>> Hi, >>>>>> >>>>>> I've read many things about vmware compute ressource: >>>>>> >>>>>> Better VMware support for non-clustered setup : >>>>>> http://projects.theforeman.org/issues/1945 >>>>>> >>>>>> and all attached bugs, but there is still something not clear: >>>>>> >>>>>> In Vmware ESXi 5.5 and vsphere, mac address is created when the VM >>>>>> boot for the first time, so obviously foreman can't retrieve the mac >>>>>> parameter from ESX. >>>>>> >>>>>> So does that mean manage and provision compute ressource on this kind >>>>>> of setup will never work ? >>>>>> >>>>> >>>>> Any hints on this ? >>>>> >>>> >>> The following is a hack that worked for me... >>> I struggled a bit generating valid mac addresses that would work with >>> DHCP (toggling the correct bits in the first octet). >>> In the end, you can see I've just set the first octet to 0x00 >>> >>> Enjoy. >>> >>> --- create_vm.rb.orig 2015-02-08 21:00:00.649826556 +0000 >>> +++ create_vm.rb 2015-02-08 21:00:35.615826533 +0000 >>> @@ -77,10 +77,18 @@ >>> :summary => nic.summary, >>> }, >>> :backing => create_nic_backing(nic, attributes), >>> - :addressType => 'generated') >>> + :addressType => 'Manual', >>> + :macAddress => randommac()) >>> } >>> end >>> >>> + def randommac() >>> + mac_octets = (1..6).collect { rand(256) } >>> + mac_octets[0] = 0x00 >>> + format = '%02X' >>> + mac_octets.collect { |i| format % [i] }.join(':') >>> + end >>> + >>> def create_controller options=nil >>> options=if options >>> >>> controller_default_options.merge(Hash[options.map{|k,v| [k.to_sym,v] }]) >>> >> >> It works. Thanks so much >> > > Great! > > >> >> (tested on foreman 1.7.2) >> >> Foreman folks, can you consider implementing this features on next >> foreman release ? >> > > I guess using a mac generated by foreman would need to be conditional on > either an explicit option set by the user, or perhaps automatically if > connected to a vsphere hypervisor (and not vcenter). > For small deployments, generating random macs (40 bits are random in my > example), should be ok (the chances of a collision being quite small [1]). > Larger deployments would be using vcenter and wouldn't need this workaround? > > [1] - > https://lazycackle.com/Probability_of_repeated_event_online_calculator__birthday_problem_.html > >

Yes i'm gonna work a bit on this, to be sure mac address have more
"chances" to be valid.

Thanks a lot :wink:

··· 2015-02-09 11:42 GMT+01:00 Alexander Fisher :

On Monday, 9 February 2015 10:37:30 UTC, Alexander Fisher wrote:

On Monday, 9 February 2015 10:12:29 UTC, claude juif wrote:

Hi Alexander,

2015-02-08 22:04 GMT+01:00 Alexander Fisher alexj...@gmail.com:

On Thursday, 5 February 2015 11:42:14 UTC, claude juif wrote:

After digging a bit this issue,

I found that ESXi does not provide mac address at creation time. I
just created a vm with vsphere client, and check the vmx file. What i get
is :

ethernet0.virtualDev = "e1000"
ethernet0.networkName = "Vlan xxx"
ethernet0.addressType = "generated"
ethernet0.present = “TRUE”

So i have no mac address for the VM at that time.

Il i boot the VM and check the vmx file again, i get this line :

ethernet0.generatedAddress = “xx:xx:xx:xx:xx:xx”

So mac address is generated at boot time.

Is there any way i can specify a mac address manually ?

I see in the fog library, that the “generated” parameter for mac
address is hardcoded.

We can also set it to manually, and adapt foreman UI so i can provide
a mac address by hand.

I’m not so comfortable with ruby, but i can do my best to fix this. Do
you have any pointer for where i should start to fix this ?

Regards,

2015-02-02 12:23 GMT+01:00 claude juif claud...@gmail.com:

2015-01-29 11:53 GMT+01:00 claude juif claud...@gmail.com:

Hi,

I’ve read many things about vmware compute ressource:

Better VMware support for non-clustered setup :
Feature #1945: Better VMWare support for non-clusters setup - Foreman

and all attached bugs, but there is still something not clear:

In Vmware ESXi 5.5 and vsphere, mac address is created when the VM
boot for the first time, so obviously foreman can’t retrieve the mac
parameter from ESX.

So does that mean manage and provision compute ressource on this
kind of setup will never work ?

Any hints on this ?

The following is a hack that worked for me…
I struggled a bit generating valid mac addresses that would work with
DHCP (toggling the correct bits in the first octet).
In the end, you can see I’ve just set the first octet to 0x00

Enjoy.

— create_vm.rb.orig 2015-02-08 21:00:00.649826556 +0000
+++ create_vm.rb 2015-02-08 21:00:35.615826533 +0000
@@ -77,10 +77,18 @@
:summary => nic.summary,
},
:backing => create_nic_backing(nic, attributes),

  •          :addressType => 'generated')
    
  •          :addressType => 'Manual',
    
  •          :macAddress => randommac())
         }
       end
    
  •    def randommac()
    
  •      mac_octets = (1..6).collect { rand(256) }
    
  •      mac_octets[0] = 0x00
    
  •      format = '%02X'
    
  •      mac_octets.collect { |i| format % [i] }.join(':')
    
  •    end
    
  •    def create_controller options=nil
         options=if options
                   controller_default_options.merge(Hash[options.map{|k,v|
    

[k.to_sym,v] }])

It works. Thanks so much

Great!

(tested on foreman 1.7.2)

Foreman folks, can you consider implementing this features on next
foreman release ?

I guess using a mac generated by foreman would need to be conditional on
either an explicit option set by the user, or perhaps automatically if
connected to a vsphere hypervisor (and not vcenter).
For small deployments, generating random macs (40 bits are random in my
example), should be ok (the chances of a collision being quite small [1]).
Larger deployments would be using vcenter and wouldn’t need this workaround?

[1] - https://lazycackle.com/Probability_of_repeated_event_
online_calculator__birthday_problem_.html

Just thought of one more thing… You’ve got a 1 in 65536 chance of
generating a mac address starting 00:50:56 (the vmware OUI), and IIRC
vmware will refuse it. Easy enough to check for this and generate another
mac if needed.


You received this message because you are subscribed to the Google Groups
"Foreman users" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to foreman-users+unsubscribe@googlegroups.com.
To post to this group, send email to foreman-users@googlegroups.com.
Visit this group at http://groups.google.com/group/foreman-users.
For more options, visit https://groups.google.com/d/optout.

Thanks Alex, This worked for me.

··· On Monday, February 9, 2015 at 8:04:09 AM UTC+11, Alexander Fisher wrote: > > On Thursday, 5 February 2015 11:42:14 UTC, claude juif wrote: >> >> After digging a bit this issue, >> >> I found that ESXi does not provide mac address at creation time. I just >> created a vm with vsphere client, and check the vmx file. What i get is : >> >> ethernet0.virtualDev = "e1000" >> ethernet0.networkName = "Vlan xxx" >> ethernet0.addressType = "generated" >> ethernet0.present = "TRUE" >> >> So i have no mac address for the VM at that time. >> >> Il i boot the VM and check the vmx file again, i get this line : >> >> ethernet0.generatedAddress = "xx:xx:xx:xx:xx:xx" >> >> So mac address is generated at boot time. >> >> Is there any way i can specify a mac address manually ? >> >> I see in the fog library, that the "generated" parameter for mac address >> is hardcoded. >> >> We can also set it to manually, and adapt foreman UI so i can provide a >> mac address by hand. >> >> I'm not so comfortable with ruby, but i can do my best to fix this. Do >> you have any pointer for where i should start to fix this ? >> >> Regards, >> >> 2015-02-02 12:23 GMT+01:00 claude juif : >> >>> >>> 2015-01-29 11:53 GMT+01:00 claude juif : >>> >>>> Hi, >>>> >>>> I've read many things about vmware compute ressource: >>>> >>>> Better VMware support for non-clustered setup : >>>> http://projects.theforeman.org/issues/1945 >>>> >>>> and all attached bugs, but there is still something not clear: >>>> >>>> In Vmware ESXi 5.5 and vsphere, mac address is created when the VM boot >>>> for the first time, so obviously foreman can't retrieve the mac parameter >>>> from ESX. >>>> >>>> So does that mean manage and provision compute ressource on this kind >>>> of setup will never work ? >>>> >>> >>> Any hints on this ? >>> >> > The following is a hack that worked for me... > I struggled a bit generating valid mac addresses that would work with DHCP > (toggling the correct bits in the first octet). > In the end, you can see I've just set the first octet to 0x00 > > Enjoy. > > --- create_vm.rb.orig 2015-02-08 21:00:00.649826556 +0000 > +++ create_vm.rb 2015-02-08 21:00:35.615826533 +0000 > @@ -77,10 +77,18 @@ > :summary => nic.summary, > }, > :backing => create_nic_backing(nic, attributes), > - :addressType => 'generated') > + :addressType => 'Manual', > + :macAddress => randommac()) > } > end > > + def randommac() > + mac_octets = (1..6).collect { rand(256) } > + mac_octets[0] = 0x00 > + format = '%02X' > + mac_octets.collect { |i| format % [i] }.join(':') > + end > + > def create_controller options=nil > options=if options > > controller_default_options.merge(Hash[options.map{|k,v| [k.to_sym,v] }]) >