Adding a second Network Adapter and setting vlan


#1

How to add a second Network Adapter and set vlan? I am using the next code lines for adding a NIC and setting VLAN on vmware, but is not working.
idx = 1
miq_provision.set_network_adapter(idx,
{
:network => ‘dvs_VLANX’,
:devicetype => ‘VirtualE1000’,
:is_dvs => false
})
miq_provision.set_nic_settings(idx,
{
:ip_addr => ‘10.2.1.23’,
:subnet_mask => ‘255.255.255.0’,
:addr_mode => [‘static’, ‘Static’]
})


#2

@pemcg Can you help me?


#3

Hi,

We use the following instead of set_network_adapter to set vlan name:

networks = [{:network=>"vlan1", :mac_address=>nil},
            {:network=>"vlan2", :mac_address=>nil}]
prov.set_option(:networks, networks)

And we use the following before the set_nic_settings method:

prov.set_option(:requested_network_adapter_count, 2)

Regards


#4

Thanks.
You gave me a clue. I changed my previous code for this and works.

prov.set_network_adapter(0, {:network=>"VLANX", :is_dvs=>true})
prov.set_network_adapter(1, {:network=>"VLANY", :is_dvs=>true})