Using Orchestrator, how do you add physical NICs as uplinks to a standard vswitch?
Onyx to the resuce!
http://www.vcoportal.de/2012/05/using-onyx-for-fast-workflow-development/
Or, google, in this case :smileysilly::
http://communities.vmware.com/thread/338685
Cheers,
Joerg
When I used the script you mentioned, I get this error message:
[2012-07-18 17:50:44.930] [I] A specified parameter was not correct.
(Dynamic Script Module name : CreateVMportgrouponNewvSwitch#26)
When I comment out the lines that add the physical NIC, the script works, but obviously does not add any uplinks to the new vswitch.
When I replace those lines with these lines:
config.pnic = System.getModule("com.vmware.onyx").array(VcPhysicalNicConfig, 1);
config.pnic[0] = new VcPhysicalNicConfig();/config.pnic[0].device = A_upLinks[0];
config.pnic[0].spec = new VcPhysicalNicSpec();
The script does not produce any error messages and works, but does NOT add any uplinks (physical NICs).
So I am confused. I am sure I am missing something.
Here is my entire script:
// ------- Create New vSwitch -------
var config = new VcHostNetworkConfig();
config.vswitch = System.getModule("com.vmware.onyx").array(VcHostVirtualSwitchConfig, 1);
config.vswitch[0] = new VcHostVirtualSwitchConfig();
config.vswitch[0].changeOperation = "add";
config.vswitch[0].name = A_vSwitchName;
config.vswitch[0].spec = new VcHostVirtualSwitchSpec();
config.vswitch[0].spec.numPorts = 128;
//config.pnic = System.getModule("com.vmware.onyx").array(VcPhysicalNicConfig, 1);
//config.pnic[0] = new VcPhysicalNicConfig();
//config.pnic[0].device = A_upLinks[0];
//config.pnic[0].spec = new VcPhysicalNicSpec();
config.vswitch[0].spec.bridge = new VcHostVirtualSwitchBondBridge();
config.vswitch[0].spec.bridge.nicDevice = System.getModule("com.vmware.onyx").array(String, A_upLinks.length);
for (var i=0; i<A_upLinks.length; i++)
config.vswitch[0].spec.bridge.nicDevice[i] = A_upLinks[i];
config.portgroup = System.getModule("com.vmware.onyx").array(VcHostPortGroupConfig, 1);
config.portgroup[0] = new VcHostPortGroupConfig();
config.portgroup[0].changeOperation = "add";
config.portgroup[0].spec = new VcHostPortGroupSpec();
config.portgroup[0].spec.name = A_Portgroup;
config.portgroup[0].spec.vlanId = 0;
config.portgroup[0].spec.vswitchName = A_vSwitchName;
config.portgroup[0].spec.policy = new VcHostNetworkPolicy();
var managedObject = A_esxiHost.configManager.networkSystem;
managedObject.updateNetworkConfig(config, "modify"); // HostNetworkSystem
When I used the script you mentioned, I get this error message:
A specified parameter was not correct.
(Dynamic Script Module name : CreateVMportgrouponNewvSwitch#26)
When I comment out the lines that add the physical NIC, the script works, but obviously does not add any uplinks to the new vswitch.
When I replace those lines with these lines:
config.pnic = System.getModule("com.vmware.onyx").array(VcPhysicalNicConfig, 1);
config.pnic[0] = new VcPhysicalNicConfig();/config.pnic[0].device = A_upLinks[0];
config.pnic[0].spec = new VcPhysicalNicSpec();
The script does not produce any error messages and works, but does NOT add any uplinks (physical NICs).
So I am confused.
Carl Paterik, VCI, VCAP-DCA, RHCSA, MCSE
VMware, Inc.
Senior Learning Consultant
cpaterik@vmware.com<mailto:cpaterik@vmware.com>
(480) 789-2887 (Cell)
Here is my latest finding/confusion:
config.vswitch[0].spec.bridge = new VcHostVirtualSwitchBondBridge();
config.vswitch[0].spec.bridge.nicDevice = System.getModule("com.vmware.onyx").array(String, A_upLinks.length);
for (i=0; i < A_upLinks.length; i++) {
config.vswitch[0].spec.bridge.nicDevice[i] = A_upLinks[i];
System.log(i + ": " + config.vswitch[i].spec.bridge.nicDevice[i]);
Server.log(i + ": " + config.vswitch[i].spec.bridge.nicDevice[i]);
System.log("PNIC: " + A_upLinks[i]);
Server.log("PNIC: " + A_upLinks[i]);
}
[2012-07-18 23:28:32.648] [I] 0: <-- Note that nicDevice[0] is NOT getting set to A_upLinks[0]
[2012-07-18 23:28:32.648] [I] PNIC: vmnic1 <-- A_upLinks[0]
[2012-07-18 23:28:32.664] [I] TypeError: Cannot read property "spec" from undefined (Dynamic Script Module name : CreateVMportgrouponNewvSwitch#16)
Got it to work. Here are the lines in the script that worked:
config.vswitch[0].spec.bridge = new VcHostVirtualSwitchBondBridge();
config.vswitch[0].spec.bridge.nicDevice = System.getModule("com.vmware.onyx").array(String, A_upLinks.length);
config.vswitch[0].spec.bridge.nicDevice = A_upLinks; <-- Change needed
Glad to see you got it work. I was about to ask what type A_upLinks is and where it comes from... 🙂
Cheers,
Joerg