VMware {code} Community
dmhaynes
Enthusiast
Enthusiast

Conflicting values when specifying NICs (Java SDK)

I am getting the following message when I attempt a CloneVM_Task:

Two conflicting values have been specified - number of nics and number of nic settings (spec.nicSetting).[/i]

The clone has one NIC already in it and I want to add another and customize both NICs.

So, I am generating two VirtualNicConfigSpecs: one with the operation as 'edit' and one with the operation as 'add'.

The controller key is set to 100 - standard PCI

The keys are set as 1000 for the existing NIC and 1001 for the new NIC.

Does anyone have any ideas why I am getting this error?

Reply
0 Kudos
9 Replies
hrobinson
VMware Employee
VMware Employee

Can you provide more information about the parameters that you are providing to the task? I.e. are you provide a ConfigSpec and/or a CustomizationSpec?

Thanks

Reply
0 Kudos
dmhaynes
Enthusiast
Enthusiast

Sure!

I am creating both config and customization specs.

config spec (new NIC)[/b]

VirtualEthernetCard nic = new VirtualVmxnet();

nic.setAddressType("manual");

nic.setMacAddress(_macAddress);

nic.setBacking(backing);

nic.setControllerKey(_controllerKey);

nic.setKey(_key);

VirtualDeviceConfigSpec spec = new VirtualDeviceConfigSpec();

spec.setDevice(nic);

spec.setOperation(VirtualDeviceConfigSpecOperation.add);

config spec (existing NIC)[/b]

as above with

spec.setOperation(VirtualDeviceConfigSpecOperation.edit);[/i]

instead of add.

Customization Spec[/b]

// define the IP settings

CustomizationIPSettings ips = new CustomizationIPSettings();

ips.setDnsDomain(params.get("dns_domain"));

ips.setDnsServerList(buildDnsServerList(params));

ips.setGateway(new String[] \{ params.get("gateway."+i) } );

CustomizationFixedIp ip = new CustomizationFixedIp();

ip.setIpAddress(params.get("ip."+i));

ips.setIp(ip);

ips.setNetBIOS(CustomizationNetBIOSMode.enableNetBIOSViaDhcp);

ips.setSubnetMask(params.get("netmask."+i));

// define the Adapter

CustomizationAdapterMapping cam = new CustomizationAdapterMapping();

cam.setMacAddress(params.get("mac_address."+i));

cam.setAdapter(ips);

// add this adapter to the list

nics.add(cam);

NOTE:[/b] The ArrayLists get converted to arrays before going into the spec.

Is this enough or would you like more?

Reply
0 Kudos
hrobinson
VMware Employee
VMware Employee

What happens if you simply supply one? In other words, which one fails?

Reply
0 Kudos
dmhaynes
Enthusiast
Enthusiast

I'm working on that at the moment...

I took both out and the clone worked fine so at least it's not something else getting in the way.

I'll post an update once I have tried with single NICs

Reply
0 Kudos
dmhaynes
Enthusiast
Enthusiast

The issue is definitely with the NIC that is already configured in the template.

If I supply either a CustomizationAdapterMapping or a VirtualNicConfigSpec that references the installed NIC, it get the message in the original posting.

Reply
0 Kudos
dmhaynes
Enthusiast
Enthusiast

A further note:

If I set the config spec for the existing NIC and do not set the adapter mapping, the error becomes:

A general system error occured: Unrecognized handle property identifier[/i]

Would something like this occur if a) the MAC addressed did not match or b) the network labels did not match?

Reply
0 Kudos
hrobinson
VMware Employee
VMware Employee

Here's how I would isolate it -- when I have time. I'm assuming that you have a VM that you can crash and burn.

First, go to the esx console,

cd /var/log/vmware

tail -f hostd.log > debug

Now, go into VI Client, and use Edit Settings for the VM and make the adds and changes that you intend on the target VM. This will do a ReconfigVM but with the same spec that you would use in the Clone.

C on the console

look at the debug file and you will see the XML that VI generated for the reconfig.

This should give the hints of what to fix.

Reply
0 Kudos
dmhaynes
Enthusiast
Enthusiast

Thanks for the advice. I took it and here is what I think I'm seeing.

1. You can issue a configSpec on a clone operation and have those devices show up in the clone target.

2. You can issue a customizationSpec but only for those devices that were in the original clone image (i.e. you cannot customize devices you have added via the configuration spec)

Various other messages in the old forum have pointed to adopting a strategy of clone with configurationSpecs and then using a separate customization task to do that part.

Reply
0 Kudos
brugh2
Contributor
Contributor

hm.. could you try removing everything from that <item> to </item>? if that works, readd the cd player to the appliance.

could you perhaps export it again then and post the ovf here? very curious what the difference is. i haven't had problems importing it yet and i used several workstation and vcenter version to do it.

Reply
0 Kudos