From 403142a43f553b1488eae795c6dfff3967825bf1 Mon Sep 17 00:00:00 2001 From: Sam Morrison Date: Fri, 14 Dec 2012 13:49:46 +1100 Subject: [PATCH] Raise NotImplemented for drivers that don't support images Fixes bug #1090169 Raise NotImplementedError on copy_image_to_volume and copy_volume_to_image on drivers that inherit from driver.ISCSIDriver that don't support this feature yet. Change-Id: I516d424a75dd21260f2ccc68467a8f6e6ac08e4d --- cinder/volume/drivers/netapp.py | 8 ++++++++ cinder/volume/drivers/nexenta/volume.py | 8 ++++++++ cinder/volume/drivers/san/san.py | 8 ++++++++ cinder/volume/drivers/windows.py | 8 ++++++++ cinder/volume/drivers/zadara.py | 8 ++++++++ 5 files changed, 40 insertions(+) diff --git a/cinder/volume/drivers/netapp.py b/cinder/volume/drivers/netapp.py index a6220ed88..387b2019c 100644 --- a/cinder/volume/drivers/netapp.py +++ b/cinder/volume/drivers/netapp.py @@ -1296,3 +1296,11 @@ class NetAppCmodeISCSIDriver(driver.ISCSIDriver): for meta in metadata: meta_dict[meta.Key] = meta.Value return meta_dict + + def copy_image_to_volume(self, context, volume, image_service, image_id): + """Fetch the image from image_service and write it to the volume.""" + raise NotImplementedError() + + def copy_volume_to_image(self, context, volume, image_service, image_id): + """Copy the volume to the specified image.""" + raise NotImplementedError() diff --git a/cinder/volume/drivers/nexenta/volume.py b/cinder/volume/drivers/nexenta/volume.py index 21d9cec41..6769f301a 100644 --- a/cinder/volume/drivers/nexenta/volume.py +++ b/cinder/volume/drivers/nexenta/volume.py @@ -279,3 +279,11 @@ class NexentaDriver(driver.ISCSIDriver): # pylint: disable=R0921 LOG.warn(_('Got error trying to delete target %(target)s,' ' assuming it is already gone: %(exc)s'), {'target': target_name, 'exc': exc}) + + def copy_image_to_volume(self, context, volume, image_service, image_id): + """Fetch the image from image_service and write it to the volume.""" + raise NotImplementedError() + + def copy_volume_to_image(self, context, volume, image_service, image_id): + """Copy the volume to the specified image.""" + raise NotImplementedError() diff --git a/cinder/volume/drivers/san/san.py b/cinder/volume/drivers/san/san.py index a2a98c758..57299d8c9 100644 --- a/cinder/volume/drivers/san/san.py +++ b/cinder/volume/drivers/san/san.py @@ -153,3 +153,11 @@ class SanISCSIDriver(ISCSIDriver): # The san_ip must always be set, because we use it for the target if not FLAGS.san_ip: raise exception.InvalidInput(reason=_("san_ip must be set")) + + def copy_image_to_volume(self, context, volume, image_service, image_id): + """Fetch the image from image_service and write it to the volume.""" + raise NotImplementedError() + + def copy_volume_to_image(self, context, volume, image_service, image_id): + """Copy the volume to the specified image.""" + raise NotImplementedError() diff --git a/cinder/volume/drivers/windows.py b/cinder/volume/drivers/windows.py index 037737440..6990475c5 100644 --- a/cinder/volume/drivers/windows.py +++ b/cinder/volume/drivers/windows.py @@ -230,3 +230,11 @@ class WindowsDriver(driver.ISCSIDriver): wt_host = self._conn_wmi.WT_Host(HostName=target_name)[0] wt_host.RemoveAllWTDisks() wt_host.Delete_() + + def copy_image_to_volume(self, context, volume, image_service, image_id): + """Fetch the image from image_service and write it to the volume.""" + raise NotImplementedError() + + def copy_volume_to_image(self, context, volume, image_service, image_id): + """Copy the volume to the specified image.""" + raise NotImplementedError() diff --git a/cinder/volume/drivers/zadara.py b/cinder/volume/drivers/zadara.py index f4ec814b9..dee160742 100644 --- a/cinder/volume/drivers/zadara.py +++ b/cinder/volume/drivers/zadara.py @@ -478,3 +478,11 @@ class ZadaraVPSAISCSIDriver(driver.ISCSIDriver): def delete_snapshot(self, snapshot): raise NotImplementedError() + + def copy_image_to_volume(self, context, volume, image_service, image_id): + """Fetch the image from image_service and write it to the volume.""" + raise NotImplementedError() + + def copy_volume_to_image(self, context, volume, image_service, image_id): + """Copy the volume to the specified image.""" + raise NotImplementedError() -- 2.45.2