VMware Cloud Community
MartinDing
Contributor
Contributor

execute reconfigureDvs_Task(spec) repeatedly on the same spec Version failed

var spec = new VcVMwareDVSConfigSpec();
spec.configVersion = dvs.config.configVersion;

...

dvs.reconfigureDvs_Task(spec);
...
dvs.reconfigureDvs_Task(spec);
 

it failed as the spec version has not changed.

error:can not complete operation due to concurrent modification by another operation.

 

if I get the new spec version before execute dvs.reconfigureDvs_Task(spec) it can work.

namely it can work with the following scripts:

var spec = new VcVMwareDVSConfigSpec();
spec.configVersion = dvs.config.configVersion;

...

dvs.reconfigureDvs_Task(spec);
...

spec.configVersion = dvs.config.configVersion;
dvs.reconfigureDvs_Task(spec);

 

But the issue it that I must do some operation in the old spec. So must recofigueDvs in the same spec version twice.

Is anyone familiar with it? Waiting for your help.

0 Kudos
2 Replies
aaron416
Enthusiast
Enthusiast

Unfortunately I don't have a solution on this, but I am working on some ESX automation to move a host to a distributed switch, which of course involves adding it via config spec. However, when I try to do so, I get the same error you saw with "cannot complete operation due to concurrent modification by another operation". So I can at least confirm it is a bug.

I will try putting the version in my configuration tomorrow to see if that helps, so thanks for posting this.

0 Kudos
aaron416
Enthusiast
Enthusiast

Can confirm, adding this piece of code got rid of the error for me.

spec is of type VcDVSConfigSpec, targetSwitch is a VMware DVS.


spec.configVersion = targetSwitch.config.configVersion;

I do have a case open on it, so we'll see what they say.

0 Kudos