Ce contenu n'est pas disponible dans la langue sélectionnée.
A.7. Defining Custom Properties
The custom properties that are accepted by the Red Hat Enterprise Virtualization Manager - and in turn passed to custom hooks - are defined using the
engine-config command. Run this command as the root user on the host where Red Hat Enterprise Virtualization Manager is installed.
The
UserDefinedVMProperties and CustomDeviceProperties configuration keys are used to store the names of the custom properties supported. Regular expressions defining the valid values for each named custom property are also contained in these configuration keys.
Multiple custom properties are separated by a semi-colon. Note that when setting the configuration key, any existing value it contained is overwritten. When combining new and existing custom properties, all of the custom properties in the command used to set the key's value must be included.
Once the configuration key has been updated, the
ovirt-engine service must be restarted for the new values to take effect.
Example A.1. Virtual Machine Properties - Defining the smartcard Custom Property
- Check the existing custom properties defined by the
UserDefinedVMPropertiesconfiguration key using the following command:engine-config -g UserDefinedVMProperties
# engine-config -g UserDefinedVMPropertiesCopy to Clipboard Copied! Toggle word wrap Toggle overflow As shown by the output below, the custom propertymemoryis already defined. The regular expression^[0-9]+$ensures that the custom property will only ever contain numeric characters.Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Because the
memorycustom property is already defined in theUserDefinedVMPropertiesconfiguration key, the new custom property must be appended to it. The additional custom property,smartcard, is added to the configuration key's value. The new custom property is able to hold a value oftrueorfalse.engine-config -s UserDefinedVMProperties='memory=^[0-9]+$;smartcard=^(true|false)$' --cver=3.2
# engine-config -s UserDefinedVMProperties='memory=^[0-9]+$;smartcard=^(true|false)$' --cver=3.2Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Verify that the custom properties defined by the
UserDefinedVMPropertiesconfiguration key have been updated correctly.Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Finally, the
ovirt-engineservice must be restarted for the configuration change to take effect.service ovirt-engine restart
# service ovirt-engine restartCopy to Clipboard Copied! Toggle word wrap Toggle overflow
Example A.2. Device Properties - Defining the interface Custom Property
- Check the existing custom properties defined by the
CustomDevicePropertiesconfiguration key using the following command:engine-config -g CustomDeviceProperties
# engine-config -g CustomDevicePropertiesCopy to Clipboard Copied! Toggle word wrap Toggle overflow As shown by the output below, no custom properties have yet been defined.engine-config -g CustomDeviceProperties
# engine-config -g CustomDeviceProperties CustomDeviceProperties: version: 3.0 CustomDeviceProperties: version: 3.1 CustomDeviceProperties: version: 3.2 CustomDeviceProperties: version: 3.3Copy to Clipboard Copied! Toggle word wrap Toggle overflow - The
interfacecustom property does not already exist, so it can be appended as is. In this example, the value of thespeedsub-property is set to a range of 0 to 99999, and the value of theduplexsub-property is set to a selection of eitherfullorhalf.engine-config -s CustomDeviceProperties="{type=interface;prop={speed=^([0-9]{1,5})$;duplex=^(full|half)$}}" --cver=3.3# engine-config -s CustomDeviceProperties="{type=interface;prop={speed=^([0-9]{1,5})$;duplex=^(full|half)$}}" --cver=3.3Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Verify that the custom properties defined by the
CustomDevicePropertiesconfiguration key have been updated correctly.engine-config -g CustomDeviceProperties
# engine-config -g CustomDeviceProperties UserDefinedVMProperties: version: 3.0 UserDefinedVMProperties: version: 3.1 UserDefinedVMProperties: version: 3.2 UserDefinedVMProperties : {type=interface;prop={speed=^([0-9]{1,5})$;duplex=^(full|half)$}} version: 3.3Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Finally, the
ovirt-engineservice must be restarted for the configuration change to take effect.service ovirt-engine restart
# service ovirt-engine restartCopy to Clipboard Copied! Toggle word wrap Toggle overflow