65a8eca8e1
A number of changes were done to the imports in the files. - Clean up flake8 H301 multiple imports per line - Remove noqa from top of files, allowing flake8 to run on all files. - Clean up relative imports in most places. This will simplify python3 support later. - Partially sort the imports. A later commit will enable that check since doing that here would have made the changeset even bigger. Story: 2003499 Task: 26561 Change-Id: Id5f95559f0d4604f4db1a1d74098063fd510142c Signed-off-by: Al Bailey <Al.Bailey@windriver.com>
89 lines
2.2 KiB
Python
Executable File
89 lines
2.2 KiB
Python
Executable File
#
|
|
# Copyright (c) 2015-2016 Wind River Systems, Inc.
|
|
#
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
#
|
|
from nfv_vim.objects._object import ObjectData
|
|
|
|
from nfv_common import debug
|
|
|
|
DLOG = debug.debug_get_logger('nfv_vim.objects.volume_snapshot')
|
|
|
|
|
|
class VolumeSnapshot(ObjectData):
|
|
"""
|
|
Volume Snapshot Object
|
|
"""
|
|
def __init__(self, nfvi_volume_snapshot):
|
|
super(VolumeSnapshot, self).__init__('1.0.0')
|
|
self._nfvi_volume_snapshot = nfvi_volume_snapshot
|
|
|
|
@property
|
|
def uuid(self):
|
|
"""
|
|
Returns the uuid of the volume snapshot
|
|
"""
|
|
return self._nfvi_volume_snapshot.uuid
|
|
|
|
@property
|
|
def name(self):
|
|
"""
|
|
Returns the name of the volume snapshot
|
|
"""
|
|
return self._nfvi_volume_snapshot.name
|
|
|
|
@property
|
|
def description(self):
|
|
"""
|
|
Returns the description of the volume snapshot
|
|
"""
|
|
return self._nfvi_volume_snapshot.description
|
|
|
|
@property
|
|
def size_gb(self):
|
|
"""
|
|
Returns the size of the volume snapshot
|
|
"""
|
|
return self._nfvi_volume_snapshot.size_gb
|
|
|
|
@property
|
|
def volume_uuid(self):
|
|
"""
|
|
Returns the volume uuid associated with the volume snapshot
|
|
"""
|
|
return self._nfvi_volume_snapshot.volume_uuid
|
|
|
|
@property
|
|
def nfvi_volume_snapshot(self):
|
|
"""
|
|
Returns the nfvi volume data
|
|
"""
|
|
return self._nfvi_volume_snapshot
|
|
|
|
def nfvi_volume_snapshot_update(self, nfvi_volume_snapshot):
|
|
"""
|
|
NFVI Volume Snapshot Update
|
|
"""
|
|
self._nfvi_volume_snapshot = nfvi_volume_snapshot
|
|
self._persist()
|
|
|
|
def _persist(self):
|
|
"""
|
|
Persist changes to volume snapshot object
|
|
"""
|
|
from nfv_vim import database
|
|
database.database_volume_snapshot_add(self)
|
|
|
|
def as_dict(self):
|
|
"""
|
|
Represent volume snapshot object as dictionary
|
|
"""
|
|
data = dict()
|
|
data['uuid'] = self.uuid
|
|
data['name'] = self.name
|
|
data['description'] = self.description
|
|
data['size_gb'] = self.size_gb
|
|
data['volume_uuid'] = self.volume_uuid
|
|
data['nfvi_volume_snapshot'] = self.nfvi_volume_snapshot.as_dict()
|
|
return data
|