* test channge for fixing gcc issue
* changed azure.yml for TESTING
* removed testing changes from azure.yml and old code from gcc.py
* Removed gcc comment version
* Removed testing changes
* Add Lisa Tool for Python Virtualenv
* GPU Pytorch case: Replace Python and Pip tool with PythonVenv
* PythonVenv: Accept path in init
* Apply lint
* PythonVenv: Change default name for venv
Change default name from 'venv' to timestamp. This is to
avoid the side effects of env being resued by multiple tests
* PythonVenv: Remove default venv path
* PythonVenv: Move Public methods above pvt methods
* PythonVenv: Fix PurePath for node
* GPU Pytorch: Increase required size to 20GB
* PythonVenv: Use local cache and build path
Use venv path as cache and build path, this is to
avoid OS disk out of space issue.
* Implement package cleanup
Implement package cleanup and invoke during GPU Pytorch test.
Creating a time stamp with year `current_year - 2` will fail on Feb 29 because there is no Feb 29 for two years ago. This test case only requires the time difference to be significantly larger than 5 minutes.
* tools: hyperv: add function to get first switch
Signed-off-by: Anirudh Rayabharam <anrayabh@linux.microsoft.com>
* tools: hyperv: add function to convert VHD <-> VHDX
Signed-off-by: Anirudh Rayabharam <anrayabh@linux.microsoft.com>
* tools: hyperv: allow choosing vm generation and secure boot
While at it, surrount all arguments to New-VM with "" (double-quotes).
Signed-off-by: Anirudh Rayabharam <anrayabh@linux.microsoft.com>
* sut_orchestrator: basic Hyper-V platform
Signed-off-by: Anirudh Rayabharam <anrayabh@linux.microsoft.com>
* shell: fix mkdir with parents for Windows node
spurplus is unable to create parent directories when the target node is
a Windows node. This is because it expects only posix paths and its
parent creation logic doesn't work well with Windows paths. In these
cases spurplus throws OSError.
To fix this, catch the OSError exception and fallback to using the mkdir
command to create the directory.
Signed-off-by: Anirudh Rayabharam <anrayabh@microsoft.com>
* sut_orchestrator/hyperv: obtain node credentials from runbook
Signed-off-by: Anirudh Rayabharam <anrayabh@microsoft.com>
* sut_orchestrator: hyperv: remove commented code
Signed-off-by: Anirudh Rayabharam <anrayabh@microsoft.com>
* sut_orchestrator: hyperv: fix formatting and type-checking issues
Signed-off-by: Anirudh Rayabharam <anrayabh@microsoft.com>
* sut_orchestrator: hyperv: move get_node_context() to context.py
Signed-off-by: Anirudh Rayabharam <anrayabh@microsoft.com>
* sut_orchestrator: hyperv: implement _delete_environment
Delete each VM by calling delete_vm() of HyperV tool.
Signed-off-by: Anirudh Rayabharam <anrayabh@microsoft.com>
* tools/hyperv: COM port configuration support
Introduce support for configuring COM ports using Set-VMComPort. This is
useful for obtaining serial console output from the virtual machine.
This functionality will be utilized in the Hyper-V platform.
Signed-off-by: Anirudh Rayabharam <anrayabh@microsoft.com>
* tools/hyperv: no need to set com_ports to empty
Configure COM ports only when com_ports is not None.
Signed-off-by: Anirudh Rayabharam <anrayabh@microsoft.com>
* tools/hyperv: add support for experimental flags
Enhance create_vm function to support VM processor experimental flags.
When this parameter is supplied, it is passed as-is to the Set-VMProcessor
cmdlet. Also, the "-Experimental" flag is passed to the New-VM cmdlet to
enable experimental features for that VM.
Signed-off-by: Anirudh Rayabharam <anrayabh@microsoft.com>
* sut_orchestrator: hyperv: support VP experimental flags
Support experimental flags for Virtual Processors (VP). These flags will
be passed as-is to the Set-VMProcessor cmdlet during VM creation.
This is an optional field in the runbook.
Signed-off-by: Anirudh Rayabharam <anrayabh@microsoft.com>
* sut_orchestrator: hyperv: serial console support
Configure COM ports for the VM using the Set-VMComPort cmdlet. The
serial console output from the guest would then be sent to the named
pipe specified when invoking Set-VMComPort.
The named pipe is not a regular file that can simply be read the usual
way. So, we use a helper Powershell script that uses the
NamedPipeClientStream .NET class to read the named pipe and write the
contents to a regular file. This helper script it copied to the server
node during environment deployment.
The powershell script is run a scheduled task. This way it runs in the
background and is not dependent on a Powershell session. This seems to
the most reliable way to run a Powershell script in the background. The
scheduled task is "started" during node deployment. The script exits
automatically if the pipe is no longer available (for e.g., VM deleted).
So, in the node delete path, just unregister the scheduled task.
Signed-off-by: Anirudh Rayabharam <anrayabh@microsoft.com>
* sut_orchestrator: hyperv: remove unnecessary prints
Signed-off-by: Anirudh Rayabharam <anrayabh@microsoft.com>
* sut_orchestrator: hyperv: capabilities and requirements handling
Reconcile node requirements with host capabilities. Make sure the
requirements can be handled by the host.
Inspired by the libvirt platform implementation.
Signed-off-by: Anirudh Rayabharam <anrayabh@microsoft.com>
* sut_orchestrator: hyperv: set node name
Signed-off-by: Anirudh Rayabharam <anrayabh@microsoft.com>
* tools/hyperv: support extra args for create_vm
Allow passing per-command extra args to create_vm(). The key of the
dictionary is the command and the value is the string containing the
extra arguments to that command.
This is useful for passing experimental arguments from the runbook.
Signed-off-by: Anirudh Rayabharam <anrayabh@microsoft.com>
* sut_orchestrator: hyperv: improved support for experimental args
Support passing per-command extra args through the runbook. Currently,
these extra args are respected only for New-VM and Set-VMProcessor
cmdlets. This option will be used to opaquely pass experimental flags
during Hyper-V VM creation.
Signed-off-by: Anirudh Rayabharam <anrayabh@microsoft.com>
* sut_orchestrator: hyperv: add copyright headers
Signed-off-by: Anirudh Rayabharam <anrayabh@microsoft.com>
* tools: hyperv: apply extra args throughout create_vm
Introduce a helper function _run_hyperv_cmdlet() that can be called from
places where extra args can be applied.
Signed-off-by: Anirudh Rayabharam <anrayabh@microsoft.com>
* sut_orchestrator: hyperv: use parellel utils to run serial log script
Use run_in_parallel_async to run the serial logging PS script. This
ensures that LISA is able to retrieve the script output and catch
errors.
While at it, rename the script from serial_console_helper.ps1 to
serial_console_logger.ps1 and add some extra logging in it.
Signed-off-by: Anirudh Rayabharam <anrayabh@microsoft.com>
* sut_orchestrator: hyperv: refactor zipped vhd handling
Extract out a helper function _unzip_vhd() to handle extracting the VHD
from an archive. This will be called if the VHD file provided via
runbook has a .zip extension.
Signed-off-by: Anirudh Rayabharam <anrayabh@microsoft.com>
* sut_orchestrator: hyperv: osdisk_size_in_gb runbook option
Introduce a new runbook parameter osdisk_size_in_gb similar to other
platforms. Handle this parameter by resizing the VHD before creating the
VHD. Resize it only if the original size of the VHD is less than the
size configured with osdisk_size_in_gb.
Signed-off-by: Anirudh Rayabharam <anrayabh@microsoft.com>
* sut_orchestrator: hyperv: convert extra_args command to lowercase
Convert the command names in extra_args to lowercase before passing it
on to convert_vm().
Signed-off-by: Anirudh Rayabharam <anrayabh@microsoft.com>
* sut_orchestrator: hyperv: logging fixes
Remove one unnecessary print and add logs before and after copying VHD
to the server.
Signed-off-by: Anirudh Rayabharam <anrayabh@microsoft.com>
* tools/ls: remove extraneous back tick in WindowsLs
Extraneous ` (back tick) causes error while using this tool.
Signed-off-by: Anirudh Rayabharam <anrayabh@microsoft.com>
* tools/cp: add Windows variant
Add a Windows variant of the cp tool. Use the Copy-Item cmdlet under the
hood to achieve the required functionality.
Signed-off-by: Anirudh Rayabharam <anrayabh@microsoft.com>
* tools/unzip: add Windows variant
Add WindowsUnzip tool. Use the Expand-Archive cmdlet to achieve the
unzip functionality.
Signed-off-by: Anirudh Rayabharam <anrayabh@microsoft.com>
* sut_orchestrator: hyperv: remove unused import in serial_console.py
Signed-off-by: Anirudh Rayabharam <anrayabh@microsoft.com>
* sut_orchestrator: hyperv: get rid of hard-coded paths
Replace hard-coded paths with appropriate path under the server node's
local_working_path.
Signed-off-by: Anirudh Rayabharam <anrayabh@microsoft.com>
* sut_orchestrator: hyperv: replace raw commands with tools
Use the Cp, Ls & Unzip tools instead of raw commands.
Signed-off-by: Anirudh Rayabharam <anrayabh@microsoft.com>
* sut_orchestrator: hyperv: minor re-arrangement and style fix
- Return early if there are no runbook requirements
- Convert extra_args to lowercase only once
- Insert blank line for aesthetics
Signed-off-by: Anirudh Rayabharam <anrayabh@microsoft.com>
* tools/cp: use Optional[PurePath] instead of PurePath | None
Fixes PR gate failure.
Signed-off-by: Anirudh Rayabharam <anrayabh@microsoft.com>
* tools/unzip: use mkdir tool instead of raw command
Signed-off-by: Anirudh Rayabharam <anrayabh@microsoft.com>
* sut_orchestrator: hyperv: cleanup dead code
Signed-off-by: Anirudh Rayabharam <anrayabh@microsoft.com>
* Revert "tools: hyperv: add function to convert VHD <-> VHDX"
This reverts commit 825ebee591.
* sut_orchestrator: hyperv: fix nox failure
Use Optional[Path] instead of Path | None.
Signed-off-by: Anirudh Rayabharam <anrayabh@microsoft.com>
* util: shell: remove extra new line
New line crept in while resolving merge conflict.
Signed-off-by: Anirudh Rayabharam <anrayabh@microsoft.com>
* mixin_modules: remove unnecessary import and try/catch block
try catch block is not needed since there are no packages for Hyper-V.
schema file doesn't need to be imported here.
Add comments to better organize the imports.
Signed-off-by: Anirudh Rayabharam <anrayabh@microsoft.com>
* sut_orchestrator: hyperv: remove unnecessary prints
These prints were added for debugging during early development and are
no longer required.
Signed-off-by: Anirudh Rayabharam <anrayabh@microsoft.com>
* sut_orchestrator: hyperv: fix multiple server warning message
Fix the message to not be too wordy. Also, it should say "first server"
instead of just "server".
As suggested by Chi, change log level to info.
Signed-off-by: Anirudh Rayabharam <anrayabh@microsoft.com>
* sut_orchestrator: hyperv: use utility to filter out ANSI escape codes
Use the filter_ansi_escape() util function.
Signed-off-by: Anirudh Rayabharam <anrayabh@microsoft.com>
* sut_orchestrator: hyperv: shorten logger names
Shorten logger names for the platform and the server node.
Just "hyperv" is sufficient. Improves logs readability by showing
important information without scrolling right.
Signed-off-by: Anirudh Rayabharam <anrayabh@microsoft.com>
* sut_orchestrator: hyperv: documentation in logger PS script
Add detailed comments to document various aspects of the script such as
different timeouts for initial connect & reconnect and the brief pipe
close that happens when VM is rebooted.
While at it, make the initial connect timeout configurable.
Signed-off-by: Anirudh Rayabharam <anrayabh@microsoft.com>
* sut_orchestrator: hyperv: use mib in host capabilities
Keep it similar to other places.
Signed-off-by: Anirudh Rayabharam <anrayabh@microsoft.com>
* sut_orchestrator: hyperv: compute host capabilities only once
Compute the first time and cache it for later use.
Signed-off-by: Anirudh Rayabharam <anrayabh@microsoft.com>
* sut_orchestrator: hyperv: clean up _initialize()
Extract parts of _initialize() out into smaller functions to make it
cleaner.
Signed-off-by: Anirudh Rayabharam <anrayabh@microsoft.com>
* sut_orchestrator: hyperv: rename server_node to host in NodeContext
Signed-off-by: Anirudh Rayabharam <anrayabh@microsoft.com>
* sut_orchestrator: hyperv: copy & extract VHD only once
Copy the VHD to the server only once. If zipped, extract it and create a
"common" VHD. A copy of this common VHD is made on the server for each
node to be deployed.
Signed-off-by: Anirudh Rayabharam <anrayabh@microsoft.com>
* sut_orchestrator: hyperv: better path managment
Create a directory for each VM in the server_node's working dir to store
the VHD and console logs for the VM. Any VM specific files introduced in
the future should also go here.
Signed-off-by: Anirudh Rayabharam <anrayabh@microsoft.com>
* sut_orchestrator: hyperv: refactor capabilities checking
Get rid of the _configure_node_capabilities method and move the logic
into _prepare_environment(). _check_host_capabilities() is unused: so
call it in _prepare_environment().
Signed-off-by: Anirudh Rayabharam <anrayabh@microsoft.com>
* sut_orchestrator: hyeprv: rename things as per code review
Signed-off-by: Anirudh Rayabharam <anrayabh@microsoft.com>
* sut_orchestrator: hyperv: fix host free memory calculation
The Get-CimInstance cmdlet return values in KB. So, divide by 1024 only
once to obtain the MB value.
Signed-off-by: Anirudh Rayabharam <anrayabh@microsoft.com>
* sut_orchestrator: hyperv: get rid of vhd_path in NodeContext
The stored value is never used later.
Signed-off-by: Anirudh Rayabharam <anrayabh@microsoft.com>
* sut_orchestrator: hyperv: don't override __init__
Signed-off-by: Anirudh Rayabharam <anrayabh@microsoft.com>
* sut_orchestrator: hyperv: support only one node for now
Signed-off-by: Anirudh Rayabharam <anrayabh@microsoft.com>
* sut_orchestrator: hyperv: enforce cpu capabilities & reserve memory for host
Signed-off-by: Anirudh Rayabharam <anrayabh@microsoft.com>
* sut_orchestrator: hyperv: get rid of _deploy_nodes()
Move the logic to _deploy_environment().
Signed-off-by: Anirudh Rayabharam <anrayabh@microsoft.com>
* sut_orchestrator: hyperv: use node_context.working_path for vhd
Instead of _server.working_path.
Signed-off-by: Anirudh Rayabharam <anrayabh@microsoft.com>
* sut_orchestrator: hyperv: node naming similar to Azure Platform
Use environment name and node index to generate node name.
Signed-off-by: Anirudh Rayabharam <anrayabh@microsoft.com>
* tools: hyperv: refactor the default switch code
Rename the method to get_default_external_switch() and modify the PS
command to return only external switches. Introduce a class VMSwitch to
represent a switch. Currently, `name` is the only property and more can
be added later.
Signed-off-by: Anirudh Rayabharam <anrayabh@microsoft.com>
* sut_orchestrator: hyperv: use get_default_external_switch()
assert if no external switch is found.
Signed-off-by: Anirudh Rayabharam <anrayabh@microsoft.com>
* sut_orchestrator: hyperv: fix extra '.' in source vhd name
plathlib.PurePath.suffix includes the '.'. No need to add it again.
Signed-off-by: Anirudh Rayabharam <anrayabh@microsoft.com>
* sut_orchestrator: hyperv: rename free_memory_mib to allocable_memory_mib
Signed-off-by: Anirudh Rayabharam <anrayabh@microsoft.com>
* sut_orchestrator: hyperv: rename _check_host_capabilities
Rename it to _is_host_resources_enough.
Signed-off-by: Anirudh Rayabharam <anrayabh@microsoft.com>
* sut_orchestrator: hyperv: Introduce VHDSource
It is a way of declaring where the VHD is to be obtained from. For now
only LocalVHDSource is implemented i.e. VHD is obtained from the local
filesystem on LISA host. Other sources can be implemented as needed.
Signed-off-by: Anirudh Rayabharam <anrayabh@microsoft.com>
* Revert "sut_orchestrator: hyperv: rename _check_host_capabilities"
This reverts commit 94929e81e0.
* sut_orchestrator: hyperv: rename _check_host_capabilities
To _is_host_resources_enough
Signed-off-by: Anirudh Rayabharam <anrayabh@microsoft.com>
* sut_orchestrator: hyperv: introduce VhdSchema
This will be used to add metadata to the Vhd. For now it will have only
vhd_path. Introduce an ImageSchema in the root folder to declare common
metadata with Azure platform. VhdSchema inherits from ImageSchema.
vhd_path is optional because user can choose to specify vhd via Source.
Signed-off-by: Anirudh Rayabharam <anrayabh@microsoft.com>
* sut_orchestrator: hyperv: overhaul source schema and implementation
Signed-off-by: Anirudh Rayabharam <anrayabh@microsoft.com>
* sut_orchestrator: hyperv: change node_capabilities name to hyperv
Signed-off-by: Anirudh Rayabharam <anrayabh@microsoft.com>
* sut_orchestrator: hyperv: rename _artifact_files to _source_files
Signed-off-by: Anirudh Rayabharam <anrayabh@microsoft.com>
* sut_orchestrator: hyperv: get rid of default value for mandatory field
Signed-off-by: Anirudh Rayabharam <anrayabh@microsoft.com>
* sut_orchestrator: hyperv: fix VM naming scheme
The existing naming scheme results in conflicting VM names across
parallel LISA runs. Use prefix similar to the resource group name used
in Azure platform.
Signed-off-by: Anirudh Rayabharam <anrayabh@microsoft.com>
* sut_orchestrator: hyperv: simplify LocalSource implementation
Assume that destination is always a dir. This simplifies the logic in
multiple places.
Signed-off-by: Anirudh Rayabharam <anrayabh@microsoft.com>
* sut_orchestrator: hyperv: delete nodes in parallel
Signed-off-by: Anirudh Rayabharam <anrayabh@microsoft.com>
* sut_orchestrator: hyperv: get rid of temp directory for zip files
Copy the zip file to the actual destination directory. After unzip, the
zip file is deleted anyway.
Signed-off-by: Anirudh Rayabharam <anrayabh@microsoft.com>
* sut_orchestrator: hyperv: add wait_delete option
The `wait_delete` option can be used to configure if during environment
delete, the platform waits for the VM delete to finish or performs the
operation asynchronously.
Signed-off-by: Anirudh Rayabharam <anrayabh@microsoft.com>
* sut_orchestrator: hyperv: use run_cmdlet_async for serial logger
run_in_parallel_async() blocks until the process exits but if
keep_environment is "always" then the process would never exit and the
lisa process never exits. There is no way to cancel the tasks because
the underlying ThreadPoolExecutor doesn't provide a way to kill running
threads.
run_cmdlet_async works perfectly for reading the serial logs. Use that
instead.
Signed-off-by: Anirudh Rayabharam <anrayabh@microsoft.com>
* sut_orchestrator: hyperv: use RemoteCopy tool to copy source files
Signed-off-by: Anirudh Rayabharam <anrayabh@microsoft.com>
* sut_orchestrator: hyperv: fix naming of private members in LocalSource
Prefix private member names with '_'.
Signed-off-by: Anirudh Rayabharam <anrayabh@microsoft.com>
* sut_orchestrator: hyperv: misc fixes in Source
- Use PurePath instead of PureWindowsPath in order to allow
consolidation of Source classes in the future.
- Receive parent logger from caller
- Use server.get_pure_path() instead of PureWindowsPath directly.
- Add helpful message for one assert.
Signed-off-by: Anirudh Rayabharam <anrayabh@microsoft.com>
* sut_orchestrator: hyperv: remove redundant __init__()
__init__() in LocalSource just calls the parent method. So, it can be
removed.
Signed-off-by: Anirudh Rayabharam <anrayabh@microsoft.com>
* sut_orchestrator: hyperv: use PurePath instead of PureWindowsPath
Signed-off-by: Anirudh Rayabharam <anrayabh@microsoft.com>
* sut_orchestrator: hyperv: accept parent_logger in source constructor
Signed-off-by: Anirudh Rayabharam <anrayabh@microsoft.com>
* sut_orchestrator: hyperv: add kwargs to Source constructor
Signed-off-by: Anirudh Rayabharam <anrayabh@microsoft.com>
---------
Signed-off-by: Anirudh Rayabharam <anrayabh@linux.microsoft.com>
Signed-off-by: Anirudh Rayabharam <anrayabh@microsoft.com>
* verify_key_vault_extension: add lisa prefix to keyvault
Add "lisa-" prefix to keyvault created by verify_key_vault_extension.
This is to maintain consistency with other resources created by LISA
* disk encryption test: Add lisa- prefix for keyvault
Add "lisa-" prefix to keyvault. This is to remain consistent
with other resources that LISA creates.
* verify_key_vault_extension: Change Cert naming
Create cert name as randomized alpha numeric string of
length 6. This will reduce potential conflicts
--format and -Z options are available with nightly tool chain only
with latest rustup and no longer supported with stable version.
This will remove unstable option arg to run integration/livemigration
test of CLH.
We will make changes to extract result from stdout as format
option is also removed
Signed-off-by: Smit Gardhariya <sgardhariya@microsoft.com>
For maximize_capability, the capability needs to accept both x64 and Arm64 architectures. When it just defaults to x64, this blocks deployment of non-GA Arm64 SKUs and images.
Introduce delete_vm_async() that internally calls run_cmdlet_async().
Refactor delete_vm() to use delete_vm_async() internally and wait for
the result.
Signed-off-by: Anirudh Rayabharam <anrayabh@microsoft.com>
Introduce new function run_cmdlet_async() that, as the name suggests,
runs the given cmdlet in an asynchronous manner i.e. doesn't wait for
the result. It returns the `Process` to the caller.
Refactor the implementation of run_cmdlet to use run_cmdlet_async
internally.
Signed-off-by: Anirudh Rayabharam <anrayabh@microsoft.com>
This commit contains changes to use custom binaries for
cloud-hypervisor tests when needed.
We will set appropriate env vars for it and cloud-hypervisor
will decide which binaries (upstream/custom) need to be uses.
Signed-off-by: Smit Gardhariya <sgardhariya@microsoft.com>
Rename the method to get_default_external_switch() and modify the PS
command to return only external switches. Introduce a class VMSwitch to
represent a switch. Currently, `name` is the only property and more can
be added later.
Signed-off-by: Anirudh Rayabharam <anrayabh@microsoft.com>
This will consume bindings.rs file if provided
before running the test, otherwise it will run
with upstream bindings.rs file.
Signed-off-by: Smit Gardhariya <sgardhariya@microsoft.com>
Add a catch for if maximize_capability is set and the availability type is set to default. It should use availability sets if the tags or properties are set.
* Case insensitive sku family check
Make the checks for sku family case insensitive to avoid bugs.
* Update API verison
Need newer version for stateless TDX deployment.
In fio test, numjob*max_iodepth (aio-nr) should always be less than aio-max-nr.
The default value of aio-max-nr is 65536.
As max_iodepth is 256, numjob which is equal to 'nproc' should not exceed 256.
/proc/sys/fs/aio-nr is the number of events currently active.
/proc/sys/fs/aio-max-nr is the maximum number of events that can be queued.
If aio-nr reaches aio-max-nr the io performance will drop and io_setup will
fail with EAGAIN.
read: https://www.kernel.org/doc/Documentation/sysctl/fs.txt
So we set numjob to 256 if numjob is larger than 256.
Authored-by: Srikanth Myakam <smyakam@microsoft.com>