VMware Cloud Community
admin
Immortal
Immortal
Jump to solution

how to attach a dvPortGroup as VC:Network

Hi,

i have a problem attaching a dvPortGroup to my e1000 adapter (because of Linux in the VM)... I use:

deviceConfigSpecs.push(System.getModule("com.vmware.library.vc.vm.spec.config.device").createVirtualEthernetCardNetworkConfigSpecE1000(vmNetwork,""));

to create the adapter and vmNetwork is the dvPortGroup. But the machine has an e1000 and the PortGroup but if  I look in the settings I see an empty network label 😞

Could anybody help?

Christian

Reply
0 Kudos
1 Solution

Accepted Solutions
Burke-
VMware Employee
VMware Employee
Jump to solution

Hello Christian, give this workflow a shot Smiley Wink

The attached .package file contains a workflow that consists of two actions. The workflow takes 3 possible inputs (only 2 are required):

1) vm (VC:VirtualMachine)

2) nicNumber (number) [optional] if not specified, first nic is chosen

3) dvPortgroup (VC:DistributedVirtualPortgroup)

The result of running the workflow is the VM's NIC should be connected to the specified Distributed Virtual Portgroup :smileygrin:

If my answer resolved or helped you, please mark it as Correct or Helpful to award points. Thank you! Visit http://www.vcoteam.info & http://blogs.vmware.com/orchestrator for vRealize Orchestrator tips and tutorials - @TechnicalValues on Twitter

View solution in original post

Reply
0 Kudos
6 Replies
tschoergez
Leadership
Leadership
Jump to solution

Hi Christian,

can you "extract" your elegant single line to different lines, and instanciate every part explicitly with var myspe = new ....ConfigSpec().

I had some issues that the push to array only works well if the objects exists already (there is also a remark in the release notes about this, but in another context)...

Regards,

Joerg

BTW: Check the Onyx-for vCO, in the onyx-action you have to create (to use copy paste from the onyx output directly) it does exactly the same thing...

admin
Immortal
Immortal
Jump to solution

Hi Jörg,

my hope was that i didn´t have to write a complete deviceConfigSpec with the new backingInfo (like Onyx does)...

But it seems i have no choice... 😞

best regards

Christian

Reply
0 Kudos
Burke-
VMware Employee
VMware Employee
Jump to solution

Hello Christian, give this workflow a shot Smiley Wink

The attached .package file contains a workflow that consists of two actions. The workflow takes 3 possible inputs (only 2 are required):

1) vm (VC:VirtualMachine)

2) nicNumber (number) [optional] if not specified, first nic is chosen

3) dvPortgroup (VC:DistributedVirtualPortgroup)

The result of running the workflow is the VM's NIC should be connected to the specified Distributed Virtual Portgroup :smileygrin:

If my answer resolved or helped you, please mark it as Correct or Helpful to award points. Thank you! Visit http://www.vcoteam.info & http://blogs.vmware.com/orchestrator for vRealize Orchestrator tips and tutorials - @TechnicalValues on Twitter
Reply
0 Kudos
mcfadyenj
Hot Shot
Hot Shot
Jump to solution

I found a way to avoid building the entire spec is to do this.

string existingNetwork = "xxxxx"

var devices = VM.config.hardware.device;

for( var i in devices){
  if(devices[i] instanceof VcVirtualE1000 || devices[i] instanceof VcVirtualPCNet32 || devices[i] instanceof VcVirtualVmxnet) {
      if (devices[i].deviceInfo.summary == existingNetwork)

Once you have the device you are looking for you can just change the backing spec to the appropriate dvportgroup

This way supports changing any network type avoiding the issues arising from the onyx methods.

Burke-
VMware Employee
VMware Employee
Jump to solution

mcfadyenj  - be sure to review the action provided in my package - you're missing the code for vmxnet2 and 3 Smiley Wink My goals when writing code for actions and workflows is to try to make them as usable as possible by many different people/orgs, so having the extra few checks for nics that could exist is quite worthwhile Smiley Happy I'm glad to see you picking up on the vCO stuff and generating conversations here!

If my answer resolved or helped you, please mark it as Correct or Helpful to award points. Thank you! Visit http://www.vcoteam.info & http://blogs.vmware.com/orchestrator for vRealize Orchestrator tips and tutorials - @TechnicalValues on Twitter
Reply
0 Kudos
admin
Immortal
Immortal
Jump to solution

Hi Burke,

works excellent! Thanks. After that i have shorten my ConfigSpec code like yours 🙂

Thanks again!

best regards

Christian

Reply
0 Kudos