def test_snapshot_progress_text(self): # One snapshot. s1 = Snapshot() s1.id = "1" s1.progress = u"25%" self.assertEqual("1: 25%", encrypt_ami._get_snapshot_progress_text([s1])) # Two snapshots. s2 = Snapshot() s2.id = "2" s2.progress = u"50%" self.assertEqual("1: 25%, 2: 50%", encrypt_ami._get_snapshot_progress_text([s1, s2]))
def test_snapshot_progress_text(self): # One snapshot. s1 = Snapshot() s1.id = '1' s1.progress = u'25%' self.assertEqual('1: 25%', encrypt_ami._get_snapshot_progress_text([s1])) # Two snapshots. s2 = Snapshot() s2.id = '2' s2.progress = u'50%' self.assertEqual('1: 25%, 2: 50%', encrypt_ami._get_snapshot_progress_text([s1, s2]))
def create_snapshot(self, volume_id, name=None, description=None): snapshot = Snapshot() snapshot.id = new_id() snapshot.status = 'pending' self.snapshots[snapshot.id] = snapshot if self.create_snapshot_callback: self.create_snapshot_callback(volume_id, snapshot) return snapshot
def test_snapshot_progress_text(self): # One snapshot. s1 = Snapshot() s1.id = '1' s1.progress = u'25%' self.assertEqual( '1: 25%', encrypt_ami._get_snapshot_progress_text([s1]) ) # Two snapshots. s2 = Snapshot() s2.id = '2' s2.progress = u'50%' self.assertEqual( '1: 25%, 2: 50%', encrypt_ami._get_snapshot_progress_text([s1, s2]) )
def wait_snapshot(ec2_conn, snap_id, logger=None, timeout=SNAPSHOT_TIMEOUT): ''' Waits until snapshot becomes 'completed' or 'error' ''' logger = logger or logging.getLogger(__name__) if isinstance(snap_id, basestring): snap = Snapshot(ec2_conn) snap.id = snap_id else: snap = snap_id logger.debug('Checking that snapshot %s is completed', snap.id) wait_until( lambda: snap.update() and snap.status != 'pending', logger=logger, timeout=timeout, error_text="EBS snapshot %s wasn't completed in a reasonable time" % snap.id ) if snap.status == 'error': raise PlatformError('Snapshot %s creation failed' % snap.id) elif snap.status == 'completed': logger.debug('Snapshot %s completed', snap.id)
def create_snapshot(self, volume_id, name=None, description=None): snapshot = Snapshot() snapshot.id = _new_id() snapshot.status = 'pending' self.snapshots[snapshot.id] = snapshot return snapshot