Jelajahi Sumber

`vgck` VM's volume groups before processing them in OSMorphing

Daniel Vincze 6 tahun lalu
induk
melakukan
a971ef340c
1 mengubah file dengan 12 tambahan dan 0 penghapusan
  1. 12 0
      coriolis/osmorphing/osmount/base.py

+ 12 - 0
coriolis/osmorphing/osmount/base.py

@@ -117,6 +117,17 @@ class BaseLinuxOSMountTools(BaseSSHOSMountTools):
                     "Ignoring improper `pvdisplay` output entry: %s" % line)
                     "Ignoring improper `pvdisplay` output entry: %s" % line)
         return pvs
         return pvs
 
 
+    def _check_vgs(self):
+        try:
+            self._exec_cmd("sudo vgck")
+        except Exception as ex:
+            raise exception.CoriolisException(
+                "An LVM-related problem has been encountered which prevents "
+                "the OSMorphing from proceeding further. Please ensure that "
+                "the source VM's LVM configuration is correct and the VM is "
+                "able to use all LVM volumes on the source. Error occured "
+                "while checking the consistency of all LVM VGs: %s" % str(ex))
+
     def _get_vgnames(self):
     def _get_vgnames(self):
         vg_names = []
         vg_names = []
         vgscan_out_lines = self._exec_cmd(
         vgscan_out_lines = self._exec_cmd(
@@ -428,6 +439,7 @@ class BaseLinuxOSMountTools(BaseSSHOSMountTools):
         LOG.debug("All simple devices to scan: %s", dev_paths)
         LOG.debug("All simple devices to scan: %s", dev_paths)
 
 
         lvm_dev_paths = []
         lvm_dev_paths = []
+        self._check_vgs()
         pvs = self._get_pvs()
         pvs = self._get_pvs()
         for vg_name in self._get_vgnames():
         for vg_name in self._get_vgnames():
             found = False
             found = False