Rename backup to image

As per IRC conversation, backup should be image so it can mean backup
or restore since they will basically be inverses of each other.

Change-Id: Ic0d14cc7bfa9071bf45d70b0731e02c106b58277
This commit is contained in:
SamYaple 2016-01-19 19:23:04 +00:00
parent 2e389f1ddb
commit fa9d060094
6 changed files with 15 additions and 16 deletions

View File

@ -12,18 +12,18 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from ekko.backup import backend
from ekko.image import drivers
class RawBackup(backend.BaseBackup):
class RawImage(drivers.BaseImage):
def get_data(self, reads):
with open(self.backup_location, 'rb') as f:
with open(self.image_location, 'rb') as f:
for start, size in reads:
f.seek(start, 0)
yield (start, f.read(size))
def get_size(self):
with open(self.backup_location, 'rb') as f:
with open(self.image_location, 'rb') as f:
f.seek(0, 2)
return f.tell()

View File

@ -18,14 +18,14 @@ import six
@six.add_metaclass(abc.ABCMeta)
class BaseBackup(object):
"""Base class for Backup drivers
class BaseImage(object):
"""Base class for Image drivers
:params backup_location: Location of device or file to backup
:params image_location: Location of device or file to image
"""
def __init__(self, backup_location):
self.backup_location = backup_location
def __init__(self, image_location):
self.image_location = image_location
@abc.abstractmethod
def get_data(self, reads):

View File

@ -20,9 +20,8 @@ classifier =
Programming Language :: Python :: 3.4
[entry_points]
ekko.backup.backend =
raw = ekko.backup._backend.raw:RawBackup
qcow2 = ekko.backup._backend.qcow2:QCOW2Backup
ekko.image.drivers =
raw = ekko.image._drivers.raw:RawImage
ekko.manifest.drivers =
osdk = ekko.manifest._drivers.osdk:OSDKManifest
sqlite = ekko.manifest._drivers.sqlite:SQLiteManifest

View File

@ -95,8 +95,8 @@ def main():
invoke_args=[args.manifest]
).driver
disk_backend = driver.DriverManager(
namespace='ekko.backup.backend',
image = driver.DriverManager(
namespace='ekko.image.drivers',
name=args.backend,
invoke_on_load=True,
invoke_args=[args.backup]
@ -109,7 +109,7 @@ def main():
invoke_args=[args.location]
).driver
size_of_disk = disk_backend.get_size()
size_of_disk = image.get_size()
incremental = 0
metadata = manifest_structure.Metadata(incremental, size_of_disk)
@ -118,7 +118,7 @@ def main():
segments_list = list(range(0, int(math.ceil(
float(size_of_disk)/metadata.segment_size))))
data_segments = read_segments(segments_list, metadata, disk_backend)
data_segments = read_segments(segments_list, metadata, image)
segments = [
storage.put_data(data_segment) for data_segment in data_segments