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 <[email protected]>:
>>
>>>
>>> 2015-01-29 11:53 GMT+01:00 claude juif <[email protected]>:
>>>
>>>> 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] }]) 
>

-- 
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/foreman-users.
For more options, visit https://groups.google.com/d/optout.

Reply via email to