Skip to content
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

Attempt dismounting Windows disks one by one #292

Merged
merged 1 commit into from
Feb 13, 2024
Merged
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
13 changes: 10 additions & 3 deletions coriolis/osmorphing/osmount/windows.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,9 +154,16 @@ def _get_fs_roots(self, fail_if_empty=False):
return drives

def _bring_nonboot_disks_offline(self):
self._conn.exec_ps_command(
"Get-Disk | Where-Object { $_.IsBoot -eq $False } | "
"Set-Disk -IsOffline $True")
nonboot_disk_nums = self._conn.exec_ps_command(
"(Get-Disk | Where-Object { $_.IsBoot -eq $False }).Number")
for disk_num in nonboot_disk_nums.splitlines():
try:
self._conn.exec_ps_command(
"Set-Disk -IsOffline $True %s" % disk_num)
except exception.CoriolisException:
LOG.warning(
"Failed setting disk %s offline. Error was: %s",
disk_num, utils.get_exception_details())

def _rebring_disks_online(self):
self._bring_nonboot_disks_offline()
Expand Down
Loading