Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions mfd_hyperv/hypervisor.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ def create_vm(
hyperv: "HyperV" = None,
connection_timeout: int = 3600,
dynamic_mng_ip: bool = False,
wait_time: Optional[int] = None,
) -> VM:
"""Create a new VM using the specified vm_params.

Expand All @@ -94,6 +95,7 @@ def create_vm(
:param hyperv: Hyperv object that will be used by Vm instance
:param connection_timeout: timeout of RPyCConnection to VM
:param dynamic_mng_ip: To enable or disable dynamic mng ip allocation
:param wait_time: amount of time a program waits
"""
commands = [
f'New-VM "{vm_params.name}" -Generation {vm_params.generation} -Path {vm_params.vm_dir_path}',
Expand All @@ -118,6 +120,9 @@ def create_vm(
if dynamic_mng_ip:
vm_params.mng_ip = mng_ip

if wait_time:
time.sleep(wait_time)

vm_connection = RPyCConnection(ip=vm_params.mng_ip, connection_timeout=connection_timeout)
vm = VM(vm_connection, vm_params, owner, hyperv, connection_timeout)

Expand Down