Skip to content

Commit

Permalink
Merge pull request #405 from jaryn/allow_setting_root_pass_and_key
Browse files Browse the repository at this point in the history
[RFR] Allow setting the root_password and authorized ssh key in rhev
  • Loading branch information
mshriver authored Dec 3, 2019
2 parents 6388d98 + 12b2728 commit 5a82cec
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion wrapanapi/systems/rhevm.py
Original file line number Diff line number Diff line change
Expand Up @@ -581,7 +581,7 @@ def wait_for_ok_status(self, timeout=1800):
message="template is OK",
delay=10)

def deploy(self, vm_name, cluster, timeout=900, power_on=True, **kwargs):
def deploy(self, vm_name, cluster, timeout=900, power_on=True, initialization=None, **kwargs):
"""
Deploy a VM using this template
Expand All @@ -597,6 +597,9 @@ def deploy(self, vm_name, cluster, timeout=900, power_on=True, **kwargs):
ram (optional) -- memory in GB
storage_domain (optional) -- storage domain name to which VM should be deployed
clone (optional) -- If set to True, use "Clone" for resource allocation, else "Thin"
initialization (optional) -- initialization values. Defined for example in
https://access.redhat.com/documentation/en-us/red_hat_virtualization/4.2/
html-single/python_sdk_guide/index#Starting_a_Virtual_Machine_with_Cloud-Init
Returns:
wrapanapi.systems.rhevm.RHEVMVirtualMachine
Expand Down Expand Up @@ -643,6 +646,8 @@ def deploy(self, vm_name, cluster, timeout=900, power_on=True, **kwargs):
if 'ram' in kwargs:
vm_kwargs['memory'] = int(kwargs['ram']) # in Bytes
vms_service = self.system.api.system_service().vms_service()
if initialization:
vm_kwargs['initialization'] = types.Initialization(**initialization)
vms_service.add(types.Vm(**vm_kwargs), clone=clone)
vm = self.system.get_vm(vm_name)
vm.wait_for_state(VmState.STOPPED, timeout=timeout)
Expand Down

0 comments on commit 5a82cec

Please sign in to comment.