VM Naming Change


#1

We recently exposed a new method to the Automate service models, giving users the ability to call the VM naming method from an Automate method.

During lifecycle provisioning, VM naming runs when the provision task is created. Service provisioning uses Service dialogs which can override the VM name. The timing is an issue since the Service dialogs are processed after task creation.

While exposing the new update_vm_name method enables users to manually call the method within a state machine, our goal is to move VM naming to task processing which runs after the Service Dialog.

I called the following test method from my VM state machine preprovision state:


prov = $evm.root['miq_provision']
$evm.log('info', "testing VM Naming  change")
$evm.log('info', "vm_target_name before: <#{prov.options[:vm_target_name]}> ")

# Could use Service dialog value here to setup new name
test_vm_name = "test_new_name_here"
prov.update_vm_name("#{test_vm_name}$n{3}",:update_request => false)

$evm.log('info', "vm_target_name after: <#{prov.options[:vm_target_name]}> ")

update_vm_name method call:
takes a single argument to pass the new vm name:
prov.update_vm_name("#{test_vm_name}$n{3}")

optional 2 argument “:update_request = true/false” (default is true)
prov.update_vm_name("#{test_vm_name}$n{3}",:update_request => false)