예제 #1
0
파일: path.py 프로젝트: vmthunder/packages
 def connect(self):
     self.device_info = connector.connect_volume(self.connection)
     self.device_path = self.device_info['path']
     print "Virtman: Path OK!  device_path = ", self.device_path
     self.connected = True
     LOG.debug("Virtman: connect to path: %s", str(self))
     return self.device_path
예제 #2
0
파일: path.py 프로젝트: vmthunder/virtman
 def connect(path):
     """
     :type path: Path
     """
     LOG.debug("Virtman: connect to path: %s", str(path))
     path.device_info = connector.connect_volume(path.connection)
     path.device_path = path.device_info['path']
     path.connected = True
     return path.device_path
예제 #3
0
    def create_snapshot(self):
        LOG.debug("Virtman: creating a snapshot for the VM instance")
        self.device_info = connector.connect_volume(self.connection)
        #snapshot_link is a symlink, like /dev/disk/by-path/xxx
        self.snapshot_link = self.device_info['path']
        if not os.path.exists(self.snapshot_link):
            raise Exception("ERROR! Could NOT find snapshot path file %s!" % self.snapshot_link)
        #snapshot_dev: like /dev/sd*, mounted from remote volume, like Cinder Volume
        self.snapshot_dev = os.path.realpath(self.snapshot_link)
        if not os.path.exists(self.snapshot_dev):
            raise Exception("ERROR! Could NOT find snapshot device %s!" % self.snapshot_dev)

        if self.snapshot_with_cache:
            self.snapshot_path = self._create_cache(self.snapshot_dev)
        else:
            self.snapshot_path = self.snapshot_dev
        LOG.debug(
            "Virtman: success! snapshot_path = %s snapshot_link = %s" % (self.snapshot_path, self.snapshot_link))
        return self.snapshot_path, self.snapshot_link