소스 검색

Attempt dismounting Windows disks one by one

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.
Daniel Vincze 2 년 전
부모
커밋
f32c25194d
1개의 변경된 파일10개의 추가작업 그리고 3개의 파일을 삭제
  1. 10 3
      coriolis/osmorphing/osmount/windows.py

+ 10 - 3
coriolis/osmorphing/osmount/windows.py

@@ -154,9 +154,16 @@ class WindowsMountTools(base.BaseOSMountTools):
         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()