VMware Cloud Community
Star_Chiang
Contributor
Contributor

How to add SRIOV network adapter to VM with vRealize Orchestrator

Hi
I have discussed the network article for a while time, but I still could not add the SRIOV network adapter to VM successfully.


Here is my vRealize Orchestrator Code.
Could someone help me finger out something wrong ?

var connectInfo = new VcVirtualDeviceConnectInfo();
connectInfo.allowGuestControl = true;
connectInfo.connected = true;
connectInfo.startConnected = true;
var vNetworkSriovBackingInfo = new VcVirtualSriovEthernetCardSriovBackingInfo();
vNetworkSriovBackingInfo.physicalFunctionBacking = new VcVirtualPCIPassthroughDeviceBackingInfo();
vNetworkSriovBackingInfo.physicalFunctionBacking.deviceId = '101d';
vNetworkSriovBackingInfo.physicalFunctionBacking.vendorId = '15b3';
vNetworkSriovBackingInfo.physicalFunctionBacking.systemId = '';
vNetworkSriovBackingInfo.physicalFunctionBacking.id = '0000:31:00.0';
vNetworkSriovBackingInfo.physicalFunctionBacking.deviceName = 'port_group_name'; // not sure if correct or not
vNetworkSriovBackingInfo.virtualFunctionBacking = new VcVirtualPCIPassthroughDeviceBackingInfo();
vNetworkSriovBackingInfo.virtualFunctionBacking.deviceId = '101d';
vNetworkSriovBackingInfo.virtualFunctionBacking.systemId = '6242d3a9-f186-0a49-524f-3cecef68da54';
vNetworkSriovBackingInfo.virtualFunctionBacking.id = '0000:31:17.7'; //0000:31:13.7
vNetworkSriovBackingInfo.virtualFunctionBacking.deviceName = 'port_group_name'; // not sure if correct or not
var sriovEthernetCard = new VcVirtualSriovEthernetCard();
sriovEthernetCard.sriovBacking = vNetworkSriovBackingInfo;
sriovEthernetCard.unitNumber = 0;
sriovEthernetCard.addressType = "Generated";
sriovEthernetCard.wakeOnLanEnabled = true;
sriovEthernetCard.connectable = connectInfo;
sriovEthernetCard.addressType = "assigned";
sriovEthernetCard.deviceInfo.label = "SR-IOV network adapter 1";
sriovEthernetCard.deviceInfo.summary = "port_group_name"; // not sure if correct or not
sriovEthernetCard.backing.network = "port_group_name"; // not sure if correct or not
sriovEthernetCard.backing.deviceName = "port_group_name"; // not sure if correct or not
vNetwork.deviceInfo.label = "SR-IOV network adapter 1";
var deviceConfigSpec = new VcVirtualDeviceConfigSpec();
deviceConfigSpec.operation = VcVirtualDeviceConfigSpecOperation.add;
deviceConfigSpec.device = sriovEthernetCard; //VcVirtualDevice ???????????
deviceConfigSpec.device.deviceInfo = new VcDescription();
deviceConfigSpec.device.deviceInfo.label = "SR-IOV network adapter 1";
deviceConfigSpec.device.deviceInfo.summary = "";
var deviceConfigSpecs = new Array();
deviceConfigSpecs[0] = deviceConfigSpec;
System.log("deviceConfigSpec : " + deviceConfigSpec);
var configSpec = new VcVirtualMachineConfigSpec();
configSpec.deviceChange = deviceConfigSpecs;

// Launch the reconfigVM task
vcVmTask = vcVm.reconfigVM_Task(configSpec);

0 Kudos
0 Replies