Skip to content

Commit

Permalink
Fix snapshot checking syntax.
Browse files Browse the repository at this point in the history
Fix snapshot existance checking and travis script
  • Loading branch information
billsung committed Apr 26, 2017
1 parent 5657405 commit 0778a07
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 24 deletions.
14 changes: 10 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
language: python

python:
- '2.7'
- '3.4'
matrix:
include:
- python: "2.7"
env: TEST_PY=py27
- python: "3.5"
env: TEST_PY=py35


sudo: false

Expand All @@ -19,6 +23,8 @@ branches:

before_script:
- chmod +x ./run_test.sh
- flake8 ./$INFORTREND_DRIVER_DIR/
- flake8 ./$INFORTREND_TEST_DIR/

script:
- ./run_test.sh
./run_test.sh $TEST_PY
4 changes: 0 additions & 4 deletions infortrend/infortrend_fc_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,10 +301,6 @@ def get_manageable_volumes(self, cinder_volumes, marker, limit, offset,
limit, offset, sort_keys,
sort_dirs)

###############################
# Manage Snapshot
###############################

def manage_existing_snapshot(self, snapshot, existing_ref):
"""Brings an existing backend storage object under Cinder management.
Expand Down
4 changes: 0 additions & 4 deletions infortrend/infortrend_iscsi_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,10 +274,6 @@ def get_manageable_volumes(self, cinder_volumes, marker, limit, offset,
limit, offset, sort_keys,
sort_dirs)

###############################
# Manage Snapshot
###############################

def manage_existing_snapshot(self, snapshot, existing_ref):
"""Brings an existing backend storage object under Cinder management.
Expand Down
12 changes: 5 additions & 7 deletions infortrend/raidcmd_cli/common_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -1507,11 +1507,10 @@ def delete_snapshot(self, snapshot):
LOG.debug('Delete Snapshot %(snapshot)s volume %(volume)s.',
{'snapshot': snapshot['id'], 'volume': volume_id})

if 'provider_location' in snapshot:
raid_snapshot_id = snapshot['provider_location']
raid_snapshot_id = snapshot.get('provider_location')

if raid_snapshot_id:
self._execute('DeleteSnapshot', raid_snapshot_id, '-y')

LOG.info('Delete Snapshot %(snapshot_id)s completed.', {
'snapshot_id': snapshot['id']})
else:
Expand All @@ -1533,15 +1532,14 @@ def _get_part_id(self, volume_id, pool_id=None, part_list=None):

def create_volume_from_snapshot(self, volume, snapshot):

if 'provider_location' not in snapshot:
raid_snapshot_id = snapshot.get('provider_location')
if raid_snapshot_id is None:
msg = _('Failed to get Raid Snapshot ID '
'from snapshot: %(snapshot_id)s.') % {
'snapshot_id': snapshot['id']}
LOG.error(msg)
raise exception.VolumeBackendAPIException(data=msg)

raid_snapshot_id = snapshot['provider_location']

self._create_partition_by_default(volume)
dst_part_id = self._get_part_id(volume['id'])

Expand Down Expand Up @@ -2490,7 +2488,7 @@ def manage_existing_snapshot_get_size(self, snapshot, existing_ref):
part = entry
break

return math.ceil(mi_to_gi(float(part['Size'])))
return int(math.ceil(mi_to_gi(float(part['Size']))))

def get_manageable_snapshots(self, cinder_snapshots, marker, limit, offset,
sort_keys, sort_dirs):
Expand Down
6 changes: 1 addition & 5 deletions run_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,6 @@ cp ./test/* $CINDER_DIR/$INFORTREND_TEST_DIR/ -r

cd $CINDER_DIR

tox -e py27 test_infortrend_* -- --concurrency=4

# flake8
flake8 ./$INFORTREND_DRIVER_DIR/
flake8 ./$INFORTREND_TEST_DIR/
tox -e ${1} test_infortrend_* -- --concurrency=4

cd ..

0 comments on commit 0778a07

Please sign in to comment.