Closed GoebelL closed 4 years ago
To set the costum value for a virtual machine the api method com.vmware.vim25.VimPortType.setCustomValue(@WebParam(name="_this", targetNamespace="urn:vim25") ManagedObjectReference arg0, @WebParam(name="key", targetNamespace="urn:vim25") String arg1, @WebParam(name="value", targetNamespace="urn:vim25") String arg2) has to be called.
To get all available attibutes we need to get the managedObjectreference of the customFieldsManager. Here we can find a property "field" where all available attributes are shown.
To clearify:
Custom attributes can now be set in vSphere. It is possible to set the custom attribute when provisioning and updating a VM. In principle, this can be set in two ways. On the one hand, it is possible to set the attribute via a service parameter. To do this, a new parameter must be added in the technical service. The parameter must be prefixed with VSPHEREATTRIBUTE. What follows this prefix is the attribute name. The value is specified as the default. The second option is to set the attribute using UDAs. For this, a UDA must be defined in OSCM, which also has the prefix VSPHEREATTRIBUTE. The attribute name must also follow the prefix. If the attribute is set using service parameters and UDAs, the UDA overwrites the service parameter value.
The attributes to be set must also already be created in the vSphere. For example: vSphere attribute BACKUP
<ParameterDefinition configurable="true" default="true" id="VSPHERE_ATTRIBUTE_BACKUP" mandatory="true" valueType="STRING">
<LocalizedDescription locale="en">Backkup for the VM</LocalizedDescription>
</ParameterDefinition>
Summary Provide for defining and updating of VMware custom attributes through OSCM
Details Generally VMware Custom attributes are provided as key-value pairs where both are of type String (don't mix the VMware term with OSCM UDAs)
Refer to VMware documentation for details: https://docs.vmware.com/en/VMware-vSphere/6.5/com.vmware.vsphere.vcenterhost.doc/GUID-73606C4C-763C-4E27-A1DA-032E4C46219D.html
Requested
Attributes can be set or updated manually via the VMware client. Target is to automate this step via OSCM, using costumer definable parameters with the VMware service. This should be implemented with existing domain model, respective naming conventions may need to be introduced.
Acceptance criteria
Additional context N/A