Skip to content

Commit

Permalink
Attempt dismounting Windows disks one by one
Browse files Browse the repository at this point in the history
This patch will make sure that every disk is dismounted one by one from the
Windows OSMorphing worker, in order to account for workers that have temporary
disks attached by default (currently common on Azure platform). This will also
prevent the migration task failure in case a disk cannot be set to offline.
  • Loading branch information
Dany9966 committed Feb 13, 2024
1 parent 578a37b commit 66b0b7a
Showing 1 changed file with 10 additions and 3 deletions.
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 as ex:
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

0 comments on commit 66b0b7a

Please sign in to comment.