Commit bddc92ee authored by Klaus Aehlig's avatar Klaus Aehlig

Make BlockDev subclasses adhere the interface for Create

In commit 702c3270 two new parameters were added to the
Create function of BlockDev. Make subclasses also adhere
this specification.
Signed-off-by: default avatarKlaus Aehlig <aehlig@google.com>
Reviewed-by: default avatarPetr Pudlak <pudlak@google.com>
parent c032b2ce
......@@ -127,7 +127,7 @@ class LogicalVolume(base.BlockDev):
@classmethod
def Create(cls, unique_id, children, size, spindles, params, excl_stor,
dyn_params):
dyn_params, *args):
"""Create a new logical volume.
"""
......@@ -209,7 +209,7 @@ class LogicalVolume(base.BlockDev):
if result.failed:
base.ThrowError("LV create failed (%s): %s",
result.fail_reason, result.output)
return LogicalVolume(unique_id, children, size, params, dyn_params)
return LogicalVolume(unique_id, children, size, params, dyn_params, *args)
@staticmethod
def _GetVolumeInfo(lvm_cmd, fields):
......@@ -751,7 +751,7 @@ class PersistentBlockDevice(base.BlockDev):
@classmethod
def Create(cls, unique_id, children, size, spindles, params, excl_stor,
dyn_params):
dyn_params, *args):
"""Create a new device
This is a noop, we only return a PersistentBlockDevice instance
......@@ -760,7 +760,8 @@ class PersistentBlockDevice(base.BlockDev):
if excl_stor:
raise errors.ProgrammerError("Persistent block device requested with"
" exclusive_storage")
return PersistentBlockDevice(unique_id, children, 0, params, dyn_params)
return PersistentBlockDevice(unique_id, children, 0, params, dyn_params,
*args)
def Remove(self):
"""Remove a device
......@@ -854,7 +855,7 @@ class RADOSBlockDevice(base.BlockDev):
@classmethod
def Create(cls, unique_id, children, size, spindles, params, excl_stor,
dyn_params):
dyn_params, *args):
"""Create a new rbd device.
Provision a new rbd volume inside a RADOS pool.
......@@ -877,7 +878,8 @@ class RADOSBlockDevice(base.BlockDev):
base.ThrowError("rbd creation failed (%s): %s",
result.fail_reason, result.output)
return RADOSBlockDevice(unique_id, children, size, params, dyn_params)
return RADOSBlockDevice(unique_id, children, size, params, dyn_params,
*args)
def Remove(self):
"""Remove the rbd device.
......@@ -1210,7 +1212,7 @@ class ExtStorageDevice(base.BlockDev):
"""
super(ExtStorageDevice, self).__init__(unique_id, children, size, params,
dyn_params)
dyn_params, *args)
(self.name, self.uuid) = args
if not isinstance(unique_id, (tuple, list)) or len(unique_id) != 2:
......@@ -1245,7 +1247,8 @@ class ExtStorageDevice(base.BlockDev):
_ExtStorageAction(constants.ES_ACTION_CREATE, unique_id,
params, size=str(size), name=name, uuid=uuid)
return ExtStorageDevice(unique_id, children, size, params, dyn_params)
return ExtStorageDevice(unique_id, children, size, params, dyn_params,
*args)
def Remove(self):
"""Remove the extstorage device.
......
......@@ -1027,7 +1027,7 @@ class DRBD8Dev(base.BlockDev):
@classmethod
def Create(cls, unique_id, children, size, spindles, params, excl_stor,
dyn_params):
dyn_params, *_):
"""Create a new DRBD8 device.
Since DRBD devices are not created per se, just assembled, this
......
......@@ -265,7 +265,7 @@ class FileStorage(base.BlockDev):
@classmethod
def Create(cls, unique_id, children, size, spindles, params, excl_stor,
dyn_params):
dyn_params, *args):
"""Create a new file.
@type size: int
......@@ -284,7 +284,8 @@ class FileStorage(base.BlockDev):
dev_path = unique_id[1]
FileDeviceHelper.CreateFile(dev_path, size)
return FileStorage(unique_id, children, size, params, dyn_params)
return FileStorage(unique_id, children, size, params, dyn_params,
*args)
def GetFileStorageSpaceInfo(path):
......
......@@ -417,7 +417,7 @@ class GlusterStorage(base.BlockDev):
@classmethod
def Create(cls, unique_id, children, size, spindles, params, excl_stor,
dyn_params):
dyn_params, *args):
"""Create a new file.
@param size: the size of file in MiB
......@@ -446,4 +446,5 @@ class GlusterStorage(base.BlockDev):
with volume_obj.Mount():
FileDeviceHelper.CreateFile(full_path, size, create_folders=True)
return GlusterStorage(unique_id, children, size, params, dyn_params)
return GlusterStorage(unique_id, children, size, params, dyn_params,
*args)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment