How to use hyperv_connect_nested_vm method in lisa

Best Python code snippet using lisa_python

nestedperf.py

Source:nestedperf.py Github

copy

Full Screen

...716 # create raid717 if setup_raid:718 mdadm.create_raid(data_disks_id)719 # get l2 vm720 nested_vm = hyperv_connect_nested_vm(721 node,722 nested_image_username,723 nested_image_password,724 nested_image_port,725 nested_image_url,726 )727 # Each fio process start jobs equal to the iodepth to read/write from728 # the disks. The max number of jobs can be equal to the core count of729 # the node.730 # Examples:731 # iodepth = 4, core count = 8 => max_jobs = 4732 # iodepth = 16, core count = 8 => max_jobs = 8733 num_jobs = []734 iodepth_iter = start_iodepth735 core_count = node.tools[Lscpu].get_core_count()736 while iodepth_iter <= max_iodepth:737 num_jobs.append(min(iodepth_iter, core_count))738 iodepth_iter = iodepth_iter * 2739 # run fio test740 perf_disk(741 nested_vm,742 start_iodepth,743 max_iodepth,744 filename,745 test_name=inspect.stack()[1][3],746 core_count=core_count,747 disk_count=1,748 disk_setup_type=DiskSetupType.raid0,749 disk_type=DiskType.premiumssd,750 test_result=test_result,751 num_jobs=num_jobs,752 size_mb=8192,753 overwrite=True,754 )755 finally:756 try:757 hyperv_remove_nested_vm(node)758 node.tools[Mdadm].stop_raid()759 except Exception as e:760 log.debug(f"Failed to cleanup Hyper-V vm: {e}")761 node.mark_dirty()762 def _windows_setup_nat(763 self,764 node: RemoteNode,765 nested_vm_name: str,766 guest_username: str,767 guest_password: str,768 guest_port: int,769 guest_image_url: str,770 ) -> RemoteNode:771 nested_vm = hyperv_connect_nested_vm(772 node,773 guest_username,774 guest_password,775 guest_port,776 guest_image_url,777 name=nested_vm_name,778 )779 # ntttcp uses port in the range (5000, 5065)780 # map all traffic on these ports to the guest vm781 local_ip = node.tools[HyperV].get_ip_address(nested_vm_name)782 for i in range(5000, 5065):783 node.tools[HyperV].setup_port_forwarding(784 nat_name=HYPERV_NAT_NAME, host_port=i, guest_port=i, guest_ip=local_ip785 )...

Full Screen

Full Screen

common.py

Source:common.py Github

copy

Full Screen

...83 )84 # wait for nested vm ssh connection to be ready85 try_connect(connection_info)86 return nested_vm87def hyperv_connect_nested_vm(88 host: RemoteNode,89 guest_username: str,90 guest_password: str,91 port: int,92 guest_image_url: str,93 name: str = "l2_vm",94 image_name: str = HYPERV_NESTED_VM_IMAGE_NAME,95 switch_name: str = "nestedvmswitch",96 nat_name: str = HYPERV_NAT_NAME,97) -> RemoteNode:98 # delete vm if it exists, otherwise it will fail to delete99 # any present images100 hyperv = host.tools[HyperV]101 hyperv.delete_vm(name)...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run lisa automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful