-
Notifications
You must be signed in to change notification settings - Fork 172
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hyper-V platform #3152
Merged
Merged
Hyper-V platform #3152
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Signed-off-by: Anirudh Rayabharam <anrayabh@linux.microsoft.com>
Signed-off-by: Anirudh Rayabharam <anrayabh@linux.microsoft.com>
While at it, surrount all arguments to New-VM with "" (double-quotes). Signed-off-by: Anirudh Rayabharam <anrayabh@linux.microsoft.com>
Signed-off-by: Anirudh Rayabharam <anrayabh@linux.microsoft.com>
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>
Signed-off-by: Anirudh Rayabharam <anrayabh@microsoft.com>
Signed-off-by: Anirudh Rayabharam <anrayabh@microsoft.com>
Signed-off-by: Anirudh Rayabharam <anrayabh@microsoft.com>
Signed-off-by: Anirudh Rayabharam <anrayabh@microsoft.com>
Delete each VM by calling delete_vm() of HyperV tool. Signed-off-by: Anirudh Rayabharam <anrayabh@microsoft.com>
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>
Configure COM ports only when com_ports is not None. Signed-off-by: Anirudh Rayabharam <anrayabh@microsoft.com>
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>
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>
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>
Signed-off-by: Anirudh Rayabharam <anrayabh@microsoft.com>
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>
Signed-off-by: Anirudh Rayabharam <anrayabh@microsoft.com>
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>
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>
Signed-off-by: Anirudh Rayabharam <anrayabh@microsoft.com>
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>
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>
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>
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>
Convert the command names in extra_args to lowercase before passing it on to convert_vm(). Signed-off-by: Anirudh Rayabharam <anrayabh@microsoft.com>
Remove one unnecessary print and add logs before and after copying VHD to the server. Signed-off-by: Anirudh Rayabharam <anrayabh@microsoft.com>
Extraneous ` (back tick) causes error while using this tool. Signed-off-by: Anirudh Rayabharam <anrayabh@microsoft.com>
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>
Add WindowsUnzip tool. Use the Expand-Archive cmdlet to achieve the unzip functionality. Signed-off-by: Anirudh Rayabharam <anrayabh@microsoft.com>
squirrelsc
reviewed
Feb 9, 2024
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>
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>
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>
squirrelsc
reviewed
Feb 16, 2024
squirrelsc
reviewed
Feb 16, 2024
Signed-off-by: Anirudh Rayabharam <anrayabh@microsoft.com>
Prefix private member names with '_'. Signed-off-by: Anirudh Rayabharam <anrayabh@microsoft.com>
squirrelsc
reviewed
Feb 22, 2024
squirrelsc
reviewed
Feb 22, 2024
squirrelsc
reviewed
Feb 22, 2024
squirrelsc
reviewed
Feb 22, 2024
squirrelsc
reviewed
Feb 22, 2024
- 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>
squirrelsc
reviewed
Feb 26, 2024
squirrelsc
reviewed
Feb 26, 2024
squirrelsc
reviewed
Feb 26, 2024
__init__() in LocalSource just calls the parent method. So, it can be removed. Signed-off-by: Anirudh Rayabharam <anrayabh@microsoft.com>
Signed-off-by: Anirudh Rayabharam <anrayabh@microsoft.com>
Signed-off-by: Anirudh Rayabharam <anrayabh@microsoft.com>
squirrelsc
reviewed
Feb 27, 2024
Signed-off-by: Anirudh Rayabharam <anrayabh@microsoft.com>
@LiliDeng LGTM. Please remember to use squash merge. |
LiliDeng
approved these changes
Mar 1, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
A new platform that provisions VMs on a Windows host using Hyper-V's PowerShell APIs.