Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 4.0

...

Add the ability to add/remove networks NICs to/from virtual machines and to change the default network NIC of a virtual machine

Feature Specifications

This will allow users to add/remove NICs from User Virtual Machines. It will also allow users to change which NIC is the default NIC.

Considerations

Currently in cloudstack there can be only on NIC on a network in cloudstackThese API calls can only happen while the VM is in a Running or a Stopped state. Otherwise an exception will be thrown.

API implementation

The new Asyncronous calls are:

addNicToVirtualMachine

Add a new NIC to the specified VM on the specified Network

parameter

description

required

virtualmachineid

Virtual Machine ID

true

networkid

Network ID

true

ipaddress

IP address

false

Event Type: NIC.CREATE
Weill throw an exception if the selected network is not in the same zone as the VM.

removeNicFromVirtualMachine

Remove specified NIC from the specified VM.

parameter

description

required

virtualmachineid

Virtual Machine ID

true

networkid nicid

Network NIC ID

true

Event Type: NIC.DELETE
Will throw an exception and fail when trying to remove the default NIC.
Will throw an exception and fail if NIC is not a NIC for the specified VM.

updateDefaultNicForVirtualMachine

Update the specified NIC to be the default NIC for the specified VM.

The NIC is only updated in the CloudStack dB and the default NIC must be updated on the VM also. An alert is popped for the user to manually update the NIC.

parameter

description

required

virtualmachineid

Virtual Machine ID

true

networkid nicid

Network NIC ID

true

Event Type: NIC.UPDATE

4 Events are generated: 2 for Assigning and 2 for removal because of the swapping of the default NICs.
Will throw an exception and fail when trying to set the current default NIC.
Will throw an exception and fail if NIC is not a NIC for the specified VM.

Details

This has been tested and works with the KVM and XEN hypervisors.