VMware Cloud Community
sp_alex
Contributor
Contributor

Network Adapter Issue - Using the PHP SDK

Hello,

We're using the PHP SDK version 5.6 to manage our VMs and we've found some issue while network adapters are added or modified.

1st issue: Adding a new network  adapter

When a new network adapter is added to an existing VM, choose the correct network type is very odd.

I'll do an example to exaplin the issue: A VM is generated using a template that originally has a netwoerk adapter type  "E1000". In this case all the interfaces added to the VM will acquire "E1000" as network type.

When the template is modified, so the network adapter switch from the original (E1000) to a different type (ex VMXnet3), the VM genereted on top of this template will have the first interface with VMXnet3 type, but adding a new interface using the API, the type will back to E1000 (original type assigned by the system to the template).

2nd issue: Modify the type of an existing network adapter

We're not sure if it's possible (no documentation available) but trying to modify the netword adapter type, the system give us an error:

Cannot change network adapter type of existing virtual machine

Making a recap, we need to have the ability to know how the system manage the network adapter type, then a way to keep aligned all the network interfaces  assigned to the same VM (then, if we start with E1000, all the interfaces will be E1000 and viceversa).

Thank you!

0 Kudos
3 Replies
IamTHEvilONE
Immortal
Immortal

AFAIK, you can't explicitly modify the NIC type after creation.  This would be a delete action, then create action.

When you create a VM from scratch, we have a default NIC time based on the OS selected.

Cloning a VM should make an exact copy of the primary settings to persist the configuration, even if this may not be correct.

When you update the VM/template, you should provide the ResourceSubType value to ensure that the specific adapter type persists.

I'm not sure how this translates to the PHP SDK, but if you don't set the ResourceSubType then it may take the default value (e1000 in your situation).

what I can't tell right now is if the ResourceSubType element is a required value to update the NIC cards.

0 Kudos
yadavk
Contributor
Contributor

Hi,

I have started looking into this and will get back with the findings.

Thanks,

Kapil

0 Kudos
yadavk
Contributor
Contributor

Hi,

The approach used to update the network adapter is to first  remove the NIC  currently in the virtual machine.

As the available adapter cannot be updated, it can only be replaced with the new configuration required once the NIC type is created.

Please let me know if you have any concern on this.

Regards,

Kapil

0 Kudos