A selector extension associates a registered object extension with one or more of the phases of an extensible object type.
Associating a selector extension with an object type or instance and registered object extension enables the object extension to receive messages when an operation on the type or instance reaches an extensible phase of its execution. A selector extension can be associated with one or more object extensions.
Prerequisites
This operation is restricted to system administrators.
GET https://vcloud.example.com/api/admin/extension/object
Procedure
Example: Create a Selector Extension for a Registered Object Extension
This example adds a selector extension to the object extension registered in Register an Object Extension. This request is appropriate for an extension that must gather and analyze Provider VDC requirements associated with the creation of a virtual machine, but not influence the operation of the phase. The selector specifies the urn:extensionPoint:vm:gatherRequirements phase and async execution, so the system does not block awaiting a response. Because the phase has an optional attribute with a value of true
phase execution continues even if the extension fails.
If the extension is to influence the outcome of the phase by replying with modified requirements, it must set type to blocking and be prepared to reply within the specified time-out interval.
In this example, the selector extension sets Priority to 1
. The system uses the Priority value to control the order of execution when multiple extensions have registered interest in a phase. Note that a Priority of 1
does not always mean that the extension is called first. For some extensions, such as those that select the urn:extensionPoint:vm:calculateSolution phase and affect placement, the highest priority position in the execution order is the final one. This approach ensures that any placement solution offered by the extension cannot be superseded by a solution offered by a different extension.
A request like this one sets this SelectorExtension as the default extension policy for all Provider VDCs in the system.
POST https://vcloud.example.com/api/admin/providervdcs/extension Content Type: application/vnd.vmware.admin.extensibility.selector+xml ... <?xml version="1.0" encoding="UTF-8"?> <SelectorExtension xmlns="http://www.vmware.com/vcloud/v1.5" > <Enabled>false</Enabled> <Priority>1</Priority> <ObjectExtensionId>83...0d39</ObjectExtensionId> <Phases> <Phase name="urn:extensionPoint:vm:gatherRequirements" type="async" optional="true" /> </Phases> </SelectorExtension>To apply this policy to a single Provider VDC, use a request of the following form:
POST https://vcloud.example.com/api/admin/providervdc/ID/extension
The system creates the selector extension and returns a SelectorExtension element that includes information derived from the contents you POSTed, and a set of Link elements that you can use to access or modify the new object extension.
201 Created Content Type: application/vnd.vmware.admin.extensibility.selector+xml ... <SelectorExtension xmlns="http://www.vmware.com/vcloud/v1.5" id="b3...f8ee" href="https://vcloud.example.com/api/admin/providervdcs/extension/b3...f8ee" ... > <Link rel="remove" href="https://vcloud.example.com/api/admin/providervdcs/extension/b3...f8ee" /> <Link rel="edit" href="https://vcloud.example.com/api/admin/providervdcs/extension/b3...f8ee" type="application/vnd.vmware.admin.extensibility.selector+xml" /> <Link rel="up" href="https://vcloud.example.com/api/admin/providervdcs/extension" type="application/vnd.vmware.admin.extensibility.selectors+xml" /> <Enabled>false</Enabled> <Priority>1</Priority> <ObjectExtensionId>83...0d39</ObjectExtensionId> <Phases> <Phase name="urn:extensionPoint:vm:gatherRequirements" optional="true" type="ASYNC" /> </Phases> </SelectorExtension>
GET https://vcloud.example.com/api/admin/extension/object/83...0d39/selectorExtensions ... <SelectorExtension xmlns="http://www.vmware.com/vcloud/v1.5" id="b3...f8ee" href="https://vcloud.example.com/api/admin/providervdcs/extension/b3...f8ee" ...> ... </SelectorExtension>