Adding Nics to vCentre VM


#1

Hello All,

I am new to CF and am working on a CF <> vCenter project. Currently I working through the network side of things. The vCenter side is dvs based. I am able to provision a vm via predifined network service catalog (network vlan is selected via catalog item config, no customization spec) successfully. I have added an addnics method (attached) to the provisioning statemachine, for if the user selects addional nics in sc form. The method executes without error, but the addional nic(s) are also not configured on the vm.

Cant attached files, so pasting logs and method here.

Thanks

Method:
idx=1
$evm.root[‘miq_provision’].set_network_adapter(idx,
{
:network => ‘VM Network’,
:devicetype => ‘VirtualVmxnet3’,
:is_dvs => true
})
$evm.log(‘info’, “CPACF: adapter”)
$evm.root[‘miq_provision’].set_nic_settings(idx,
{
:ip_addr => ‘10.213.148.232’,
:subnet_mask => ‘255.255.252.0’,
:addr_mode => [‘static’, ‘Static’]
})
$evm.log(‘info’, “CPACF: settings”)

Log:
[----] I, [2017-05-11T11:04:30.705835 #23727:62113c] INFO – : Q-task_id([miq_provision_51000000000457]) Next State=[AddNics]
[----] I, [2017-05-11T11:04:30.706312 #23727:62113c] INFO – : Q-task_id([miq_provision_51000000000457]) In State=[AddNics], invoking [on_entry] method=[update_provision_status(status
=> ‘Adding Nics’)]
[----] I, [2017-05-11T11:04:31.261825 #23727:62113c] INFO – : Q-task_id([miq_provision_51000000000457]) Updated namespace [Infrastructure/VM/Provisioning/StateMachines/VMProvision_vm
/update_provision_status CPA/Infrastructure/VM/Provisioning/StateMachines]
[----] I, [2017-05-11T11:04:31.263325 #23727:62113c] INFO – : Q-task_id([miq_provision_51000000000457]) Invoking [inline] method [/CPA/Infrastructure/VM/Provisioning/StateMachines/VM
Provision_VM/update_provision_status] with inputs [{“status”=>“Adding Nics”}]
[----] I, [2017-05-11T11:04:31.264113 #23727:62113c] INFO – : Q-task_id([miq_provision_51000000000457]) <AEMethod [/CPA/Infrastructure/VM/Provisioning/StateMachines/VMProvision_VM/up
date_provision_status]> Starting
[----] I, [2017-05-11T11:04:31.967262 #23727:62113c] INFO – : Q-task_id([miq_provision_51000000000457]) <AEMethod [/CPA/Infrastructure/VM/Provisioning/StateMachines/VMProvision_VM/up
date_provision_status]> Ending
[----] I, [2017-05-11T11:04:31.967354 #23727:62113c] INFO – : Q-task_id([miq_provision_51000000000457]) Method exited with rc=MIQ_OK
[----] I, [2017-05-11T11:04:31.967765 #23727:62113c] INFO – : Q-task_id([miq_provision_51000000000457]) Processing State=[AddNics]
[----] I, [2017-05-11T11:04:31.968003 #23727:62113c] INFO – : Q-task_id([miq_provision_51000000000457]) Following Relationship [miqaedb:/Infrastructure/VM/Reconfigure/StateMachines/A
dd_Nics#create]
[----] I, [2017-05-11T11:04:32.011313 #23727:62113c] INFO – : Q-task_id([miq_provision_51000000000457]) Updated namespace [miqaedb:/Infrastructure/VM/Reconfigure/StateMachines/Add_Ni
cs#create CPA/Infrastructure/VM/Reconfigure]
[----] I, [2017-05-11T11:04:32.015468 #23727:62113c] INFO – : Q-task_id([miq_provision_51000000000457]) Processing State=[execute]
[----] I, [2017-05-11T11:04:32.015622 #23727:62113c] INFO – : Q-task_id([miq_provision_51000000000457]) Following Relationship [miqaedb:/Infrastructure/VM/Reconfigure/Methods/Add_Nic
s#create]
[----] I, [2017-05-11T11:04:32.057035 #23727:62113c] INFO – : Q-task_id([miq_provision_51000000000457]) Updated namespace [miqaedb:/Infrastructure/VM/Reconfigure/Methods/Add_Nics#cre
ate CPA/Infrastructure/VM/Reconfigure]
[----] I, [2017-05-11T11:04:32.101155 #23727:62113c] INFO – : Q-task_id([miq_provision_51000000000457]) Updated namespace [Infrastructure/VM/Reconfigure/Methods/add_nics CPA/Infrast
ructure/VM/Reconfigure]
[----] I, [2017-05-11T11:04:32.108307 #23727:62113c] INFO – : Q-task_id([miq_provision_51000000000457]) Invoking [inline] method [/CPA/Infrastructure/VM/Reconfigure/Methods/Add_Nics]
with inputs [{}]
[----] I, [2017-05-11T11:04:32.109133 #23727:62113c] INFO – : Q-task_id([miq_provision_51000000000457]) <AEMethod [/CPA/Infrastructure/VM/Reconfigure/Methods/Add_Nics]> Starting
[----] I, [2017-05-11T11:04:32.678663 #23727:7a8f71c] INFO – : Q-task_id([miq_provision_51000000000457]) CPACF: adapter
[----] I, [2017-05-11T11:04:32.795419 #23727:7a8f71c] INFO – : Q-task_id([miq_provision_51000000000457]) CPACF: settings
[----] I, [2017-05-11T11:04:32.827029 #23727:62113c] INFO – : Q-task_id([miq_provision_51000000000457]) <AEMethod [/CPA/Infrastructure/VM/Reconfigure/Methods/Add_Nics]> Ending
[----] I, [2017-05-11T11:04:32.827170 #23727:62113c] INFO – : Q-task_id([miq_provision_51000000000457]) Method exited with rc=MIQ_OK
[----] I, [2017-05-11T11:04:32.827762 #23727:62113c] INFO – : Q-task_id([miq_provision_51000000000457]) Followed Relationship [miqaedb:/Infrastructure/VM/Reconfigure/Methods/Add_Nic
s#create]
[----] I, [2017-05-11T11:04:32.827954 #23727:62113c] INFO – : Q-task_id([miq_provision_51000000000457]) Processed State=[execute] with Result=[ok]
[----] I, [2017-05-11T11:04:32.828104 #23727:62113c] INFO – : Q-task_id([miq_provision_51000000000457]) Processed State =[execute]
[----] I, [2017-05-11T11:04:32.828354 #23727:62113c] INFO – : Q-task_id([miq_provision_51000000000457]) Next State=[]
[----] I, [2017-05-11T11:04:32.828595 #23727:62113c] INFO – : Q-task_id([miq_provision_51000000000457]) Followed Relationship [miqaedb:/Infrastructure/VM/Reconfigure/StateMachines/A
dd_Nics#create]
[----] I, [2017-05-11T11:04:32.828720 #23727:62113c] INFO – : Q-task_id([miq_provision_51000000000457]) Processed State=[AddNics] with Result=[ok]
[----] I, [2017-05-11T11:04:32.828869 #23727:62113c] INFO – : Q-task_id([miq_provision_51000000000457]) Processed State =[AddNics]
[----] I, [2017-05-11T11:04:32.829059 #23727:62113c] INFO – : Q-task_id([miq_provision_51000000000457]) In State=[AddNics], invoking [on_exit] method=[update_provision_status(status
=> ‘Nics Added’)]
[----] I, [2017-05-11T11:04:33.377052 #23727:62113c] INFO – : Q-task_id([miq_provision_51000000000457]) Updated namespace [Infrastructure/VM/Provisioning/StateMachines/VMProvision_vm
/update_provision_status CPA/Infrastructure/VM/Provisioning/StateMachines]
[----] I, [2017-05-11T11:04:33.378584 #23727:62113c] INFO – : Q-task_id([miq_provision_51000000000457]) Invoking [inline] method [/CPA/Infrastructure/VM/Provisioning/StateMachines/VM
Provision_VM/update_provision_status] with inputs [{“status”=>“Nics Added”}]


#2

Some initial feedback. An important point for this is to have a vmware customization specification that have a sufficient number of NICs configured in it. If you have a requirement to provision a server with say 5 NICs then the cust spec should have 5 NICs specified. The same cust spec can however be used to build servers with only one or two NICs.


vCenter adding NICs and the OS template
#3

Is there a relationship between NICs in the OS template and whats provisioned via CF? Can OS templates with NICs influence what is configured by CF & Cust spec? For instance my devicetype VirtualVmxnet3 is being ignored and all nics are devicetype E1000…