Identify the virtual machines or vApps that an extension manages
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.You have a
vCenter Server
extension that manages virtual machines or vApps.For example, your solution can create 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 What are the 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
.- In the program that defines the virtual machines or vApps that an extension deploys, create an instance ofVirtualMachineConfigSpecorVAppConfigSpec.For example, you can instantiateVirtualMachineConfigSpec.VirtualMachineConfigSpec configSpec = new VirtualMachineConfigSpec();
- Create an instance ofManagedByInfo.ManagedByInfo managedByInfo = new ManagedByInfo();
- Set theManagedByInfoextensionKeyproperty to the extension key of the extension that deploys the virtual machines or vApps.Use the extension key that you define in the implementation ofExtensionin your extension.managedByInfo.setExtensionKey("com.mycompany.myextension");
- Set theManagedByInfotypeproperty to identify the virtual machine or vApp as being of a certain type.Set thetypeproperty to a descriptive name for this type of virtual machine. In the implementation ofExtensionthat manages the extension, you can apply icons and descriptions to all virtual machines or vApps of this type that the extension deploys.managedByInfo.setType("my VM type");
- Pass theManagedByInfoinstance to themanagedByproperty of theVirtualMachineConfigSpecorVAppConfigSpecimplementation.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
.