"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "cinder/objects/backup.py" between
cinder-15.0.1.tar.gz and cinder-15.1.0.tar.gz

About: OpenStack Cinder (Core Service: Block Storage) provides persistent block storage to running instances. Its pluggable driver architecture facilitates the creation and management of block storage devices.
The "Train" series (latest release).

backup.py  (cinder-15.0.1):backup.py  (cinder-15.1.0)
skipping to change at line 44 skipping to change at line 44
# Version 1.1: Add new field num_dependent_backups and extra fields # Version 1.1: Add new field num_dependent_backups and extra fields
# is_incremental and has_dependent_backups. # is_incremental and has_dependent_backups.
# Version 1.2: Add new field snapshot_id and data_timestamp. # Version 1.2: Add new field snapshot_id and data_timestamp.
# Version 1.3: Changed 'status' field to use BackupStatusField # Version 1.3: Changed 'status' field to use BackupStatusField
# Version 1.4: Add restore_volume_id # Version 1.4: Add restore_volume_id
# Version 1.5: Add metadata # Version 1.5: Add metadata
# Version 1.6: Add encryption_key_id # Version 1.6: Add encryption_key_id
# Version 1.7: Add parent # Version 1.7: Add parent
VERSION = '1.7' VERSION = '1.7'
OPTIONAL_FIELDS = ('metadata',) OPTIONAL_FIELDS = ('metadata', 'parent')
fields = { fields = {
'id': fields.UUIDField(), 'id': fields.UUIDField(),
'user_id': fields.StringField(), 'user_id': fields.StringField(),
'project_id': fields.StringField(), 'project_id': fields.StringField(),
'volume_id': fields.UUIDField(), 'volume_id': fields.UUIDField(),
'host': fields.StringField(nullable=True), 'host': fields.StringField(nullable=True),
'availability_zone': fields.StringField(nullable=True), 'availability_zone': fields.StringField(nullable=True),
skipping to change at line 157 skipping to change at line 157
self._reset_metadata_tracking(fields=fields) self._reset_metadata_tracking(fields=fields)
def obj_load_attr(self, attrname): def obj_load_attr(self, attrname):
if attrname not in self.OPTIONAL_FIELDS: if attrname not in self.OPTIONAL_FIELDS:
raise exception.ObjectActionError( raise exception.ObjectActionError(
action='obj_load_attr', action='obj_load_attr',
reason=_('attribute %s not lazy-loadable') % attrname) reason=_('attribute %s not lazy-loadable') % attrname)
if not self._context: if not self._context:
raise exception.OrphanedObjectError(method='obj_load_attr', raise exception.OrphanedObjectError(method='obj_load_attr',
objtype=self.obj_name()) objtype=self.obj_name())
if attrname == 'parent':
if self.parent_id:
self.parent = self.get_by_id(self._context, self.parent_id)
else:
self.parent = None
self.obj_reset_changes(fields=[attrname]) self.obj_reset_changes(fields=[attrname])
def obj_what_changed(self): def obj_what_changed(self):
changes = super(Backup, self).obj_what_changed() changes = super(Backup, self).obj_what_changed()
if hasattr(self, 'metadata') and self.metadata != self._orig_metadata: if hasattr(self, 'metadata') and self.metadata != self._orig_metadata:
changes.add('metadata') changes.add('metadata')
return changes return changes
def create(self): def create(self):
skipping to change at line 213 skipping to change at line 218
msg = _("Can't decode backup record.") msg = _("Can't decode backup record.")
except ValueError: except ValueError:
msg = _("Can't parse backup record.") msg = _("Can't parse backup record.")
raise exception.InvalidInput(reason=msg) raise exception.InvalidInput(reason=msg)
def encode_record(self, **kwargs): def encode_record(self, **kwargs):
"""Serialize backup object, with optional extra info, into a string.""" """Serialize backup object, with optional extra info, into a string."""
# We don't want to export extra fields and we want to force lazy # We don't want to export extra fields and we want to force lazy
# loading, so we can't use dict(self) or self.obj_to_primitive # loading, so we can't use dict(self) or self.obj_to_primitive
record = {name: field.to_primitive(self, name, getattr(self, name)) record = {name: field.to_primitive(self, name, getattr(self, name))
for name, field in self.fields.items()} for name, field in self.fields.items() if name != 'parent'}
# We must update kwargs instead of record to ensure we don't overwrite # We must update kwargs instead of record to ensure we don't overwrite
# "real" data from the backup # "real" data from the backup
kwargs.update(record) kwargs.update(record)
retval = jsonutils.dump_as_bytes(kwargs) retval = jsonutils.dump_as_bytes(kwargs)
return base64.encode_as_text(retval) return base64.encode_as_text(retval)
@base.CinderObjectRegistry.register @base.CinderObjectRegistry.register
class BackupList(base.ObjectListBase, base.CinderObject): class BackupList(base.ObjectListBase, base.CinderObject):
VERSION = '1.0' VERSION = '1.0'
 End of changes. 3 change blocks. 
2 lines changed or deleted 7 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)