VMware Cloud Community
vMarkusK1985
Expert
Expert
Jump to solution

Problem with VM NIC Config on DVS

Hallo,

I created a Workflow to switch all NICs of a VM to a temporary DV Portgroup and back to the original one.

All Logs look Fine, but nothing happens (Reconfigure Task in vCenter is running but nothing is changed):

[2015-08-21 11:24:58.352] [I] VM to Process: Xxxxx0467

[2015-08-21 11:24:58.401] [I] Network Name of NIC 1 from total 1 is: SDC-3001 (CC01CCC-C03-dvSwitch1)

[2015-08-21 11:24:58.401] [I] ...Switching to Temp Network.

[2015-08-21 11:24:58.401] [D] active_dvPortgroup: DynamicWrapper (Instance) : [VcDistributedVirtualPortgroup]-[class com.vmware.vmo.plugin.vi4.model.VimDistributedVirtualPortgroup] -- VALUE : DistributedVirtualPortgroup<dvportgroup-110>'SDC-3001'

[2015-08-21 11:24:58.401] [D] temp_dvPortgroup: DynamicWrapper (Instance) : [VcDistributedVirtualPortgroup]-[class com.vmware.vmo.plugin.vi4.model.VimDistributedVirtualPortgroup] -- VALUE : DistributedVirtualPortgroup<dvportgroup-48220>'dvPortGroup-Migration'

[2015-08-21 11:24:58.434] [I] devices.deviceInfo.summary: 'DVSwitch: a3 16 28 50 b6 99 e7 7b-02 3f 24 f2 7d c0 32 89'

[2015-08-21 11:25:04.116] [I] Switching to Temp Network Completed.

[2015-08-21 11:25:04.116] [I] ...Switching Back.

[2015-08-21 11:29:35.009] [I] devices.deviceInfo.summary: 'DVSwitch: a3 16 28 50 b6 99 e7 7b-02 3f 24 f2 7d c0 32 89'

[2015-08-21 11:29:35.689] [I] Switching Back finished.

You can see that something is wrong in the marked Log entries, this must be different DVPs…

I have attached the Documentation and the workflow itself.

Maybe I am totally blind…

https://mycloudrevolution.com | https://twitter.com/vMarkus_K | https://github.com/vMarkusK
1 Solution

Accepted Solutions
vMarkusK1985
Expert
Expert
Jump to solution

Hi,

i found the Problem:

- The Action "getNetworkForGivenNic" uses ID 1 for first Nic

- but the Workflow "Connect virtual machine NIC number to distributed virtual port group" uses ID 0 for the Same NIC

So:

// modify the NIC ID for Change Workflow

var NicNumer = loopCounter - 1;

https://mycloudrevolution.com | https://twitter.com/vMarkus_K | https://github.com/vMarkusK

View solution in original post

4 Replies
vMarkusK1985
Expert
Expert
Jump to solution

I added some more debug check after first switch:

System.log ("Switching to Temp Network Completed.");

System.debug ("actionResult_ActualNetworkAfterTempSwitch: " + actionResult_ActualNetworkAfterTempSwitch.Name);

if ( actionResult_ActualNetworkAfterTempSwitch != temp_dvPortgroup){

  System.error ("Switching to Temp Network failed.");

  System.debug ("actionResult_ActualNetworkAfterTempSwitch: " + actionResult_ActualNetworkAfterTempSwitch);

  System.debug ("temp_dvPortgroup: " + temp_dvPortgroup);

  }

else {

  System.log ("Switching to Temp Network Completed.");

  }

System.log ("...Switching Back.");

And the resultis as expected:

[2015-08-21 12:46:16.309] [I] VM to Process: Xxxx0424

[2015-08-21 12:46:16.427] [D] active_dvPortgroup: DynamicWrapper (Instance) : [VcDistributedVirtualPortgroup]-[class com.vmware.vmo.plugin.vi4.model.VimDistributedVirtualPortgroup] -- VALUE : DistributedVirtualPortgroup<dvportgroup-110>'SDC-3001'

[2015-08-21 12:46:16.427] [D] temp_dvPortgroup: DynamicWrapper (Instance) : [VcDistributedVirtualPortgroup]-[class com.vmware.vmo.plugin.vi4.model.VimDistributedVirtualPortgroup] -- VALUE : DistributedVirtualPortgroup<dvportgroup-48220>'dvPortGroup-Migration'

[2015-08-21 12:46:16.427] [I] Network Name of NIC 1 from total 1 NICs is: SDC-3001 (CC01CCC-C03-dvSwitch1)

[2015-08-21 12:46:16.427] [I] ...Switching to Temp Network.

[2015-08-21 12:46:16.474] [I] devices.deviceInfo.summary: 'DVSwitch: a3 16 28 50 b6 99 e7 7b-02 3f 24 f2 7d c0 32 89'

[2015-08-21 12:46:18.258] [I] Switching to Temp Network Completed.

[2015-08-21 12:46:18.258] [D] actionResult_ActualNetworkAfterTempSwitch: SDC-3001 (CC01CCC-C03-dvSwitch1)

[2015-08-21 12:46:18.258] [E] Switching to Temp Network failed.

[2015-08-21 12:46:18.258] [D] actionResult_ActualNetworkAfterTempSwitch: DynamicWrapper (Instance) : [VcDistributedVirtualPortgroup]-[class com.vmware.vmo.plugin.vi4.model.VimDistributedVirtualPortgroup] -- VALUE : DistributedVirtualPortgroup<dvportgroup-110>'SDC-3001'

[2015-08-21 12:46:18.258] [D] temp_dvPortgroup: DynamicWrapper (Instance) : [VcDistributedVirtualPortgroup]-[class com.vmware.vmo.plugin.vi4.model.VimDistributedVirtualPortgroup] -- VALUE : DistributedVirtualPortgroup<dvportgroup-48220>'dvPortGroup-Migration'

[2015-08-21 12:46:18.259] [I] ...Switching Back.

[2015-08-21 12:46:18.281] [I] devices.deviceInfo.summary: 'DVSwitch: a3 16 28 50 b6 99 e7 7b-02 3f 24 f2 7d c0 32 89'

[2015-08-21 12:46:18.941] [I] Switching Back finished.

What is wrong with this action?

https://mycloudrevolution.com | https://twitter.com/vMarkus_K | https://github.com/vMarkusK
0 Kudos
dvatov
VMware Employee
VMware Employee
Jump to solution

var active_dvPortgroup = actionResult_ActualNetwork;

At the same time active_dvPortgroup is output parameter of the scripting block. Isn't this declaration hiding the output parameter?

0 Kudos
vMarkusK1985
Expert
Expert
Jump to solution

Hi,

I did that because the Action "getNetworkForGivenNic" has a wrong type of output... I'm not shure if this works (it looks like), but the Problem is earlier than the usage of this var in the workflow:  Also the "Real" Input of "temp_dvPortgroup" has no effect in NIC-Change...

https://mycloudrevolution.com | https://twitter.com/vMarkus_K | https://github.com/vMarkusK
0 Kudos
vMarkusK1985
Expert
Expert
Jump to solution

Hi,

i found the Problem:

- The Action "getNetworkForGivenNic" uses ID 1 for first Nic

- but the Workflow "Connect virtual machine NIC number to distributed virtual port group" uses ID 0 for the Same NIC

So:

// modify the NIC ID for Change Workflow

var NicNumer = loopCounter - 1;

https://mycloudrevolution.com | https://twitter.com/vMarkus_K | https://github.com/vMarkusK