コード例 #1
0
 def validateImagePath(self):
     """
     Validate that the image dir exists and valid.
     In the file volume repositories,
     the image dir must exists after creation its first volume.
     """
     imageDir = image.ImageManifest(self.repoPath).getImageDir(
         self.sdUUID, self.imgUUID)
     if not self.oop.os.path.isdir(imageDir):
         raise se.ImagePathError(imageDir)
     if not self.oop.os.access(imageDir, os.R_OK | os.W_OK | os.X_OK):
         raise se.ImagePathError(imageDir)
     self._imagePath = imageDir
コード例 #2
0
ファイル: blockVolume.py プロジェクト: fancyKai/vdsm
 def validateImagePath(self):
     """
     Block SD supports lazy image dir creation
     """
     imageDir = image.ImageManifest(self.repoPath).getImageDir(
         self.sdUUID, self.imgUUID)
     if not os.path.isdir(imageDir):
         try:
             os.mkdir(imageDir, 0o755)
         except Exception:
             self.log.exception("Unexpected error")
             raise se.ImagePathError(imageDir)
     self._imagePath = imageDir
コード例 #3
0
    def validateImagePath(self):
        """
        Block SD supports lazy image dir creation
        """
        imageDir = image.ImageManifest(self.repoPath).getImageDir(
            self.sdUUID, self.imgUUID)

        # Image directory may be a symlink to /run/vdsm/storage/sd/image
        # created when preparing an image before starting a vm.
        if os.path.islink(imageDir) and not os.path.exists(imageDir):
            self.log.warning("Removing stale image directory link %r",
                             imageDir)
            os.unlink(imageDir)

        if not os.path.isdir(imageDir):
            try:
                os.mkdir(imageDir, 0o755)
            except Exception:
                self.log.exception("Unexpected error")
                raise se.ImagePathError(imageDir)
        self._imagePath = imageDir