Esempio n. 1
0
 def connect(self):
     self.device_info = connector.connect_volume(self.connection)
     self.device_path = self.device_info['path']
     print "VMThunder: Path OK!  device_path = ", self.device_path
     self.connected = True
     LOG.debug("VMThunder: connect to path: %s", str(self))
     return self.device_path
Esempio n. 2
0
 def connect(self):
     self.device_info = connector.connect_volume(self.connection)
     self.device_path = self.device_info['path']
     print "VMThunder: Path OK!  device_path = ", self.device_path
     self.connected = True
     LOG.debug("VMThunder: connect to path: %s", str(self))
     return self.device_path
Esempio n. 3
0
 def connect(self):
     device_info = connector.connect_volume(self.connection)
     self.device_info = device_info
     self.device_path = self.device_info['path']
     self.connected = True
     LOG.debug("VMThunder: connect to path: %s", str(self))
     return self.device_path
Esempio n. 4
0
    def __init__(self, session, name, snapshot_connection):
        self.connection = snapshot_connection
        snapshot_info = connector.connect_volume(snapshot_connection)
        snapshot_link = snapshot_info['path']
        if os.path.exists(snapshot_link):
            self.snapshot_link = snapshot_link
        else:
            raise Exception("Could NOT find snapshot link file %s!" % snapshot_link)

        snapshot_dev = os.path.realpath(self.snapshot_link)
        if os.path.exists(snapshot_dev) or snapshot_dev == snapshot_link:
            super(StackBDImage, self).__init__(session, name, snapshot_dev)
        else:
            raise Exception("Could NOT find snapshot device %s!" % snapshot_dev)
Esempio n. 5
0
    def create_snapshot(self):
        LOG.debug("VMThunder: 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

        return self.snapshot_path, self.snapshot_link
Esempio n. 6
0
    def create_snapshot(self):
        LOG.debug("VMThunder: 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(
            "VMThunder: success! snapshot_path = %s snapshot_link = %s" % (self.snapshot_path, self.snapshot_link))
        return self.snapshot_path, self.snapshot_link
Esempio n. 7
0
 def _login_target(self, connections):
     """This method is to login target and return the connected_paths
     connection_properties for iSCSI must include:
     target_portal - ip and optional port
     target_iqn - iSCSI Qualified Name
     target_lun - LUN id of the volume_name
     """
     connected_paths = []
     for connection in connections:
         if self._connection_exits(connection) is False:
             LOG.debug("iscsi login target according the connection :")
             LOG.debug(connection)
             device_info = connector.connect_volume(connection)
             path = device_info['path']
             path = os.path.realpath(path)
             self._add_target_path_dict(connection, path)
             connected_paths.append(path)
             self.connections.append(connection)
     return connected_paths
Esempio n. 8
0
    def __init__(self, vm_name, session, snapshot_connection):
        self.vm_name = vm_name
        self.connection = snapshot_connection

        snapshot_info = connector.connect_volume(snapshot_connection)
        snapshot_link = snapshot_info['path']
        if os.path.exists(snapshot_link):
            self.snapshot_link = snapshot_link
        else:
            raise Exception("Could NOT find snapshot link file %s!" % snapshot_link)

        snapshot_dev = os.path.realpath(self.snapshot_link)
        if os.path.exists(snapshot_dev) or snapshot_dev == snapshot_link:
            self.snapshot_dev = snapshot_dev
        else:
            raise Exception("Could NOT find snapshot device %s!" % snapshot_dev)
        self.session = session
        self.volume_name = session.volume_name
        self.snapshot_path = ''
        self.has_link = False

        LOG.debug("creating a instance of name %s " % self.vm_name)