예제 #1
0
    def _create_snapshot(self,
                         volume,
                         description=None,
                         tags=None,
                         nowait=False):
        LOG.debug('Creating snapshot of EBS volume %s', volume)
        if not linux.os.windows:
            coreutils.sync()

        # conn.create_snapshot leaks snapshots when RequestLimitExceeded occured
        params = {'VolumeId': volume}
        if description:
            params['Description'] = description[0:255]
        snapshot = self._conn.get_object('CreateSnapshot',
                                         params,
                                         boto.ec2.snapshot.Snapshot,
                                         verb='POST')

        try:
            LOG.debug('Snapshot %s created for EBS volume %s', snapshot.id,
                      volume)
            if tags:
                self._create_tags_async(snapshot.id, tags)
            if not nowait:
                self._wait_snapshot(snapshot)
        except boto.exception.BotoServerError, e:
            if e.code != 'RequestLimitExceeded':
                raise
예제 #2
0
파일: ebs.py 프로젝트: digitalwm/scalarizr
 def _create_snapshot(self, volume, description=None, tags=None, nowait=False):
     LOG.debug('Creating snapshot of EBS volume %s', volume)
     coreutils.sync()
     snapshot = self._conn.create_snapshot(volume, description)
     LOG.debug('Snapshot %s created for EBS volume %s', snapshot.id, volume)
     if tags:
         self._create_tags_async(snapshot.id, tags)
     if not nowait:
         self._wait_snapshot(snapshot)
     return snapshot
예제 #3
0
파일: ebs.py 프로젝트: yoyama/scalarizr
 def _create_snapshot(self, volume, description=None, tags=None, nowait=False):
     LOG.debug('Creating snapshot of EBS volume %s', volume)
     coreutils.sync()
     snapshot = self._conn.create_snapshot(volume, description)
     LOG.debug('Snapshot %s created for EBS volume %s', snapshot.id, volume)
     if tags:
         self._create_tags_async(snapshot.id, tags)
     if not nowait:
         self._wait_snapshot(snapshot)
     return snapshot
예제 #4
0
    def _create_snapshot(self, volume_id=None, description=None, nowait=False):
        volume_id = self.id
        self._check_cinder_connection()

        LOG.debug('Creating snapshot of Cinder volume %s', volume_id)
        coreutils.sync()
        snapshot = self._cinder.volume_snapshots.create(
            volume_id, force=True, description=description)
        LOG.debug('Snapshot %s created for Cinder volume %s', snapshot.id,
                  volume_id)
        if not nowait:
            self._wait_snapshot(snapshot.id)
        return snapshot
예제 #5
0
    def _create_snapshot(self, volume_id=None, description=None, nowait=False):
        volume_id = self.id
        self._check_cinder_connection()

        LOG.debug('Creating snapshot of Cinder volume %s', volume_id)
        coreutils.sync()
        snapshot = self._cinder.volume_snapshots.create(volume_id,
                                                        force=True,
                                                        display_description=description)
        LOG.debug('Snapshot %s created for Cinder volume %s',
                  snapshot.id, volume_id)
        if not nowait:
            self._wait_snapshot(snapshot.id)
        return snapshot
예제 #6
0
    def freeze(self, volume, state):
        self._mysql_init.start()
        client = self._client()
        client.lock_tables()
        coreutils.sync()
        if int(__mysql__["replication_master"]):
            (log_file, log_pos) = client.master_status()
        else:
            slave_status = client.slave_status()
            log_pos = slave_status["Exec_Master_Log_Pos"]
            log_file = slave_status["Master_Log_File"]

        upd = {"log_file": log_file, "log_pos": log_pos}
        state.update(upd)
        self.tags.update(upd)
예제 #7
0
    def freeze(self, volume, state):
        self._mysql_init.start()
        client = self._client()
        client.lock_tables()
        coreutils.sync()
        if int(__mysql__['replication_master']):
            (log_file, log_pos) = client.master_status()
        else:
            slave_status = client.slave_status()
            log_pos = slave_status['Exec_Master_Log_Pos']
            log_file = slave_status['Master_Log_File']

        upd = {'log_file': log_file, 'log_pos': log_pos}
        state.update(upd)
        self.tags.update(upd)
예제 #8
0
파일: ebs.py 프로젝트: golovast/scalarizr
	def _create_snapshot(self, volume, description=None, tags=None, nowait=False):
		LOG.debug('Creating snapshot of EBS volume %s', volume)
		coreutils.sync()		
		snapshot = self._conn.create_snapshot(volume, description)
		LOG.debug('Snapshot %s created for EBS volume %s', snapshot.id, volume)
		if tags:
			try:
				LOG.debug('Applying tags to EBS snapshot %s (tags: %s)', 
						snapshot.id, tags)
				self._conn.create_tags([snapshot.id], tags)
			except:
				LOG.warn('Cannot apply tags to EBS snapshot %s. Error: %s', 
						snapshot.id, sys.exc_info()[1])
		if not nowait:
			self._wait_snapshot(snapshot)	
		return snapshot		
예제 #9
0
파일: ebs.py 프로젝트: notbrain/scalarizr
 def _create_snapshot(self, volume, description=None, tags=None, nowait=False):
     LOG.debug('Creating snapshot of EBS volume %s', volume)
     coreutils.sync()
     snapshot = self._conn.create_snapshot(volume, description)
     LOG.debug('Snapshot %s created for EBS volume %s', snapshot.id, volume)
     if tags:
         try:
             LOG.debug('Applying tags to EBS snapshot %s (tags: %s)',
                             snapshot.id, tags)
             self._conn.create_tags([snapshot.id], tags)
         except:
             LOG.warn('Cannot apply tags to EBS snapshot %s. Error: %s',
                             snapshot.id, sys.exc_info()[1])
     if not nowait:
         self._wait_snapshot(snapshot)
     return snapshot
예제 #10
0
파일: raid.py 프로젝트: worldline/scalarizr
    def _snapshot(self, description, tags, **kwds):
        coreutils.sync()
        lvm2.dmsetup('suspend', self.device)
        try:
            description = 'Raid%s disk ${index}%s' % (self.level, \
                                            '. %s' % description if description else '')
            disks_snaps = storage2.concurrent_snapshot(volumes=self.disks,
                                                       description=description,
                                                       tags=tags,
                                                       **kwds)

            return storage2.snapshot(type='raid',
                                     disks=disks_snaps,
                                     lvm_group_cfg=lvm2.backup_vg_config(
                                         self.vg),
                                     level=self.level,
                                     pv_uuid=self.pv_uuid,
                                     vg=self.vg)
        finally:
            lvm2.dmsetup('resume', self.device)
예제 #11
0
파일: ebs.py 프로젝트: chenleji/scalarizr
    def _create_snapshot(self, volume, description=None, tags=None, nowait=False):
        LOG.debug('Creating snapshot of EBS volume %s', volume)
        if not linux.os.windows:
            coreutils.sync()

        # conn.create_snapshot leaks snapshots when RequestLimitExceeded occured 
        params = {'VolumeId': volume}
        if description:
            params['Description'] = description[0:255]
        snapshot = self._conn.get_object('CreateSnapshot', params, 
                    boto.ec2.snapshot.Snapshot, verb='POST')

        try:
            LOG.debug('Snapshot %s created for EBS volume %s', snapshot.id, volume)
            if tags:
                self._create_tags_async(snapshot.id, tags)
            if not nowait:
                self._wait_snapshot(snapshot)
        except boto.exception.BotoServerError, e:
            if e.code != 'RequestLimitExceeded':
                raise
예제 #12
0
파일: raid.py 프로젝트: notbrain/scalarizr
    def _snapshot(self, description, tags, **kwds):
        coreutils.sync()
        lvm2.dmsetup('suspend', self.device)
        try:
            description = 'Raid%s disk ${index}%s' % (self.level, \
                                            '. %s' % description if description else '')
            disks_snaps = storage2.concurrent_snapshot(
                    volumes=self.disks,
                    description=description,
                    tags=tags, **kwds
            )

            return storage2.snapshot(
                    type='raid',
                    disks=disks_snaps,
                    lvm_group_cfg=lvm2.backup_vg_config(self.vg),
                    level=self.level,
                    pv_uuid=self.pv_uuid,
                    vg=self.vg
            )
        finally:
            lvm2.dmsetup('resume', self.device)