diff --git a/manila/api/v1/share_snapshots.py b/manila/api/v1/share_snapshots.py index ce262247ff..2a4c9b6384 100644 --- a/manila/api/v1/share_snapshots.py +++ b/manila/api/v1/share_snapshots.py @@ -33,13 +33,11 @@ LOG = logging.getLogger(__name__) def make_snapshot(elem): - elem.set('id') - elem.set('size') - elem.set('status') - elem.set('name') - elem.set('description') - elem.set('share_proto') - elem.set('export_location') + attrs = ['id', 'size', 'status', 'name', 'description', 'share_proto', + 'export_location', 'links', 'share_id', 'created_at', + 'share_size'] + for attr in attrs: + elem.set(attr) class SnapshotTemplate(xmlutil.TemplateBuilder): diff --git a/manila/api/v1/shares.py b/manila/api/v1/shares.py index 7a54847bf6..a33f40109d 100644 --- a/manila/api/v1/shares.py +++ b/manila/api/v1/shares.py @@ -32,17 +32,11 @@ LOG = logging.getLogger(__name__) def make_share(elem): - elem.set('id') - elem.set('size') - elem.set('availability_zone') - elem.set('status') - elem.set('name') - elem.set('description') - elem.set('share_proto') - elem.set('export_location') - elem.set('links') - elem.set('snapshot_id') - elem.set('created_at') + attrs = ['id', 'size', 'availability_zone', 'status', 'name', + 'description', 'share_proto', 'export_location', 'links', + 'snapshot_id', 'created_at'] + for attr in attrs: + elem.set(attr) def remove_invalid_options(context, search_options, allowed_search_options):