If an extension manages virtual machines or vApps, you can identify those virtual machines or vApps as being managed by that extension. You can add icons to the objects that the extension manages that appear in the vCenter Server inventory, and warn users if they try to perform actions on those objects.

For example, the EAM Sample Solution creates ESX agent virtual machines. The ESX agent virtual machines that it manages appear in the vCenter Server inventory with an icon that identifies them as ESX agents. A panel appears in the Summary tab for those virtual machines that identifies ESX Agent Manager as the solution that manages them. If you attempt to perform an operation directly on an ESX agent virtual machine, you see a warning that instructs you to perform the operation by using ESX Agent Manager, rather than by performing it manually on the virtual machine. For the list of operations that trigger warnings when you try to perform them on a virtual machine or vApp that an extension manages, see Operations that Trigger Warnings from Extensions.

You identify a virtual machine or vApp as belonging to an extension by setting the managedBy property in the VirtualMachineConfigSpec or VAppConfigSpec implementations that define the virtual machines or vApps that the extension manages. You set the managedBy property to a ManagedByInfo object.

You identify the extension that manages a virtual machine or vApp by setting the extensionKey property in the ManagedByInfo object. You specify different types of virtual machine or vApp that an extension manages by setting the type property in ManagedByInfo.

If you set the ManagedByInfo type property in the virtual machine or vApp definition, you can pass this value to the ExtManagedEntityInfo implementation in the extension definition. ExtManagedEntityInfo applies descriptions and icons to all the virtual machines or vApps of this type that the extension manages.

For information about configuring and deploying virtual machines programmatically, see the vSphere Web Services SDK Programming Guide and the VMware vSphere API Reference.

You have a vCenter Server extension that manages virtual machines or vApps.

Note

The EAM Sample Solution uses ESX Agent Manager to deploy ESX agent virtual machines. ESX Agent Manager sets the ManagedByInfo properties on these virtual machines to mark them as belonging to ESX Agent Manager. The EAM Sample Solution does not set the ManagedByInfo properties itself. The code extracts in this procedure are not taken from the source files of the EAM Sample Solution.

1

In the program that defines the virtual machines or vApps that an extension deploys, create an instance of VirtualMachineConfigSpec or VAppConfigSpec.

For example, you can instantiate VirtualMachineConfigSpec.

VirtualMachineConfigSpec configSpec = new VirtualMachineConfigSpec();
2

Create an instance of ManagedByInfo.

VirtualMachineConfigSpec configSpec = new VirtualMachineConfigSpec();
ManagedByInfo managedByInfo = new ManagedByInfo();
3

Set the ManagedByInfo extensionKey property to the extension key of the extension that deploys the virtual machines or vApps.

Use the extension key that you define in the implementation of Extension in your extension.

VirtualMachineConfigSpec configSpec = new VirtualMachineConfigSpec();
ManagedByInfo managedByInfo = new ManagedByInfo();
managedByInfo.setExtensionKey("com.yourcompany.yourextension");
4

Set the ManagedByInfo type property to identify the virtual machine or vApp as being of a certain type.

Set the type property to a descriptive name for this type of virtual machine. In the implementation of Extension that manages the extension, you can apply icons and descriptions to all virtual machines or vApps of this type that the extension deploys.

VirtualMachineConfigSpec configSpec = new VirtualMachineConfigSpec();
ManagedByInfo managedByInfo = new ManagedByInfo();
managedByInfo.setExtensionKey("com.yourcompany.yourextension");
managedByInfo.setType("your_vm_type"");
5

Pass the ManagedByInfo instance to the managedBy property of the VirtualMachineConfigSpec or VAppConfigSpec implementation.

VirtualMachineConfigSpec configSpec = new VirtualMachineConfigSpec();
ManagedByInfo managedByInfo = new ManagedByInfo();
managedByInfo.setExtensionKey("com.yourcompany.yourextension");
managedByInfo.setType("your_vm_type");

configSpec.setManagedBy(managedByInfo);

You set the managedBy properties in a virtual machine or vApp definition, to identify the virtual machines or vApps as being of a certain type and as belonging to an extension.

Set the types of virtual machines or vApps that an extension manages by implementing ExtManagedEntityInfo.