-
Notifications
You must be signed in to change notification settings - Fork 29
[Windows] add checking black screen after GOSC on Windows with desktop #783
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
Draft
Tomorrow9
wants to merge
6
commits into
vmware:main
Choose a base branch
from
Tomorrow9:fix_win_gosc_black
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| # Copyright 2025 VMware, Inc. | ||
| # SPDX-License-Identifier: BSD-2-Clause | ||
| --- | ||
| # Get these 2 processes' info to check if the Windows is actively installing or | ||
| # configuring something. | ||
| # "TiWorker.exe (Windows Modules Installer Worker)" is the primary process | ||
| # responsible for installing updates and modifying system files. | ||
| # "msiexec.exe" is the Windows Installer engine, if running as SYSTEM user (Session 0), | ||
| # it means a background installation (like a driver or managed app) is happening. | ||
| # | ||
| - name: "Set facts of the commands for checking Windows status" | ||
| ansible.builtin.set_fact: | ||
| check_tiworker: "Get-Process TiWorker -ErrorAction SilentlyContinue | Format-List -Property *" | ||
| check_msiexec: "Get-Process msiexec -IncludeUserName -ErrorAction SilentlyContinue | Where-Object {$_.UserName -match 'SYSTEM'} | Format-List -Property *" | ||
|
|
||
| - name: "Get 'TiWorker.exe' process info" | ||
| include_tasks: win_execute_cmd.yml | ||
| vars: | ||
| win_powershell_cmd: "{{ check_tiworker }}" | ||
| win_execute_cmd_ignore_error: true | ||
|
|
||
| - name: "Save the result of getting 'TiWorker.exe' process info" | ||
| ansible.builtin.set_fact: | ||
| check_tiworker_result: "{{ win_powershell_cmd_output }}" | ||
|
|
||
| - name: "Get 'msiexec.exe' process info" | ||
| include_tasks: win_execute_cmd.yml | ||
| vars: | ||
| win_powershell_cmd: "{{ check_msiexec }}" | ||
| win_execute_cmd_ignore_error: true | ||
|
|
||
| - name: "Save the result of getting 'msiexec.exe' process info" | ||
| ansible.builtin.set_fact: | ||
| check_msiexec_result: "{{ win_powershell_cmd_output }}" | ||
|
|
||
| - name: "Set fact of Windows is actively installing updates" | ||
| ansible.builtin.set_fact: | ||
| os_in_active_updates: true | ||
| when: > | ||
| (check_tiworker_result.rc is defined and check_tiworker_result.rc == 0) or | ||
| (check_msiexec_result.stdout is defined and check_msiexec_result.stdout | length != 0) | ||
|
|
||
| - name: "Set fact of Windows is not actively installing updates" | ||
| ansible.builtin.set_fact: | ||
| os_in_active_updates: false | ||
| when: | ||
| - check_tiworker_result.rc is defined and check_tiworker_result.rc != 0 | ||
| - check_msiexec_result.stdout is defined and check_msiexec_result.stdout | length == 0 |
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| # Copyright 2025 VMware, Inc. | ||
| # SPDX-License-Identifier: BSD-2-Clause | ||
| --- | ||
| # Check Windows system readiness after booting up | ||
| # | ||
| - name: "Initialize the readiness of Windows" | ||
| ansible.builtin.set_fact: | ||
| os_in_active_updates: false | ||
|
|
||
| - name: "Retry to check if Windows is actively installing updates" | ||
| include_tasks: win_check_active_update.yml | ||
| loop: "{{ range(1, 11) | list }}" | ||
| loop_control: | ||
| pause: 3 | ||
| break_when: | ||
| - os_in_active_updates | ||
|
|
||
| - name: "Debug message" | ||
| ansible.builtin.debug: | ||
| msg: "Not get the processes that can indicating the Windows is actively installing updates in 30s." | ||
| when: not os_in_active_updates | ||
|
|
||
| - name: "Debug message" | ||
| ansible.builtin.debug: | ||
| msg: "Windows guest OS is actively installing updates or configuring something." | ||
| when: os_in_active_updates | ||
|
|
||
| - name: "Wait for Windows updates installation completes" | ||
| when: os_in_active_updates | ||
| block: | ||
| - name: "Retry to check if Windows completes installing updates" | ||
| include_tasks: win_check_active_update.yml | ||
| loop: "{{ range(1, 201) | list }}" | ||
| loop_control: | ||
| pause: 3 | ||
| break_when: | ||
| - not os_in_active_updates | ||
| - name: "Debug message" | ||
| ansible.builtin.debug: | ||
| msg: "Still can get the processes that indicating the Windows is actively installing updates in 600s." | ||
| when: os_in_active_updates | ||
| - name: "Debug message" | ||
| ansible.builtin.debug: | ||
| msg: "Windows guest OS completes the updates install." | ||
| when: not os_in_active_updates |
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| # Copyright 2025 VMware, Inc. | ||
| # SPDX-License-Identifier: BSD-2-Clause | ||
| --- | ||
| # Description: | ||
| # Get process 'explorer.exe' in Windows guest OS to check | ||
| # if there is black screen issue occurs. | ||
| # Parameters: | ||
| # win_get_explorer_timeout: the retry time in seconds to get | ||
| # the status of process 'explorer.exe'. | ||
| # Return: | ||
| # win_explorer_running: true or false. Whether the process | ||
| # 'explorer.exe' is running in guest OS. | ||
| # | ||
| - name: "Initialize the status of process 'explorer.exe'" | ||
| ansible.builtin.set_fact: | ||
| win_explorer_running: false | ||
|
|
||
| - name: "Wait for 'explorer.exe' process starting" | ||
| ansible.windows.win_shell: 'Get-Process -Name explorer' | ||
| delegate_to: "{{ vm_guest_ip }}" | ||
| register: get_service_status | ||
| delay: 5 | ||
| retries: "{{ (win_get_explorer_timeout | default(300) / 5) | round | int }}" | ||
| until: | ||
| - get_service_status.rc is defined | ||
| - get_service_status.rc == 0 | ||
| ignore_errors: true | ||
| ignore_unreachable: true | ||
|
|
||
| - name: "Set fact of the status of process 'explorer.exe'" | ||
| ansible.builtin.set_fact: | ||
| win_explorer_running: true | ||
| when: | ||
| - win_powershell_cmd_output.rc is defined | ||
| - win_powershell_cmd_output.rc == 0 |
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,39 +1,41 @@ | ||
| # Copyright 2022-2024 VMware, Inc. | ||
| # SPDX-License-Identifier: BSD-2-Clause | ||
| --- | ||
| # Retry to get serivce status in Windows guest OS until it's running | ||
| # Retry to get serivce status in Windows guest OS until it reaches the expected state. | ||
| # Parameters: | ||
| # win_service_name: the service name | ||
| # win_service_name: the service name to getting status. | ||
| # win_wait_service_state (optional): the state of the service, e.g., 'Stopped', 'Running'. | ||
| # Default value is 'Running'. | ||
| # win_wait_service_timeout (optional): the timeout in seconds to wait for service state. | ||
| # Default value is 60s. | ||
| # | ||
| - name: "Check required parameter" | ||
| ansible.builtin.fail: | ||
| msg: "win_service_name must be defined before get service status" | ||
| when: win_service_name is undefined or not win_service_name | ||
| ansible.builtin.assert: | ||
| that: | ||
| - win_service_name is defined | ||
| - win_service_name | length > 0 | ||
| msg: "Parameter 'win_service_name' must be defined before get service status." | ||
|
|
||
| - name: "Check specified service '{{ win_service_name }}' status in Windows" | ||
| ansible.windows.win_shell: 'get-service -Name {{ win_service_name }} | foreach {$_.Status}' | ||
| delay: 5 | ||
| retries: 10 | ||
| ansible.windows.win_shell: 'Get-Service -Name {{ win_service_name }} | foreach {$_.Status}' | ||
| delegate_to: "{{ vm_guest_ip }}" | ||
| register: get_service_status | ||
| delay: 5 | ||
| retries: "{{ (win_wait_service_timeout | default(60) / 5) | round | int }}" | ||
| until: | ||
| - get_service_status is defined | ||
| - get_service_status.stdout_lines is defined | ||
| - get_service_status.stdout_lines | length != 0 | ||
| - get_service_status.stdout_lines[0] == 'Running' | ||
| - get_service_status.stdout_lines | length == 1 | ||
| - get_service_status.stdout_lines[0] == win_wait_service_state | default('Running') | ||
| ignore_errors: true | ||
| ignore_unreachable: true | ||
|
|
||
| - name: "Check service '{{ win_service_name }}' status in Windows" | ||
| ansible.builtin.assert: | ||
| that: | ||
| - get_service_status is defined | ||
| - get_service_status.stdout_lines is defined | ||
| - get_service_status.stdout_lines | length != 0 | ||
| - get_service_status.stdout_lines[0] == 'Running' | ||
| - get_service_status.failed is defined | ||
| - not get_service_status.failed | ||
| fail_msg: >- | ||
| Windows service '{{ win_service_name }}' status is not running after 50 seconds. | ||
| Current service status is '{{ get_service_status.stdout_lines[0] | default("") }}'. | ||
|
|
||
| - name: "Display the PowerShell command result" | ||
| ansible.builtin.debug: var=get_service_status | ||
| when: enable_debug is defined and enable_debug | ||
| Windows service '{{ win_service_name }}' status is not {{ win_wait_service_state | default('Running') }} | ||
| after {{ win_wait_service_timeout | default(60) }} seconds. | ||
| Get service status in guest OS '{{ get_service_status.stdout_lines | default("") }}'. |
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.
Uh oh!
There was an error while loading. Please reload this page.