VMware: remove unused argument from _delete_datastore_file()

The 'instance' argument is not used.

TrivialFix

Change-Id: Iec4f239d86cbd9b4a56713a17e9afa577971b032
This commit is contained in:
Radoslav Gerganov
2014-09-26 17:00:09 +03:00
parent 3b43f769c5
commit 3ae6453c54
2 changed files with 8 additions and 11 deletions

View File

@@ -1121,7 +1121,7 @@ class VMwareVMOpsTestCase(test.NoDBTestCase):
self._context, vi, tmp_image_path)
mock_cache.assert_called_once_with(vi, tmp_image_path)
mock_delete_datastore_file.assert_called_once_with(
vi.instance, str(tmp_dir_path), self._dc_info.ref)
str(tmp_dir_path), self._dc_info.ref)
def test_fetch_image_if_missing(self):
self._test_fetch_image_if_missing()
@@ -1207,7 +1207,7 @@ class VMwareVMOpsTestCase(test.NoDBTestCase):
DsPathMatcher(expected_path_to_create),
image_info.file_size_in_kb)
mock_delete_datastore_file.assert_called_once_with(
vi.instance, DsPathMatcher(expected_image_path),
DsPathMatcher(expected_image_path),
self._dc_info.ref)
@mock.patch.object(ds_util, 'file_move')

View File

@@ -185,11 +185,11 @@ class VMwareVMOps(object):
files = [name.replace(".vmdk", "-flat.vmdk"), name]
for file in files:
ds_path = ds_util.DatastorePath.parse(file)
self._delete_datastore_file(instance, ds_path, dc_ref)
self._delete_datastore_file(ds_path, dc_ref)
LOG.debug("Extended root virtual disk")
def _delete_datastore_file(self, instance, datastore_path, dc_ref):
def _delete_datastore_file(self, datastore_path, dc_ref):
try:
ds_util.file_delete(self._session, datastore_path, dc_ref)
except (vexc.CannotDeleteFileException,
@@ -314,8 +314,7 @@ class VMwareVMOps(object):
flat_vmdk_name = vi.cache_image_path.basename.replace('.vmdk',
'-flat.vmdk')
flat_vmdk_ds_loc = tmp_dir_loc.join(vi.ii.image_id, flat_vmdk_name)
self._delete_datastore_file(vi.instance, str(flat_vmdk_ds_loc),
vi.dc_info.ref)
self._delete_datastore_file(str(flat_vmdk_ds_loc), vi.dc_info.ref)
return tmp_dir_loc, flat_vmdk_ds_loc
def _prepare_iso_image(self, vi):
@@ -351,8 +350,7 @@ class VMwareVMOps(object):
str(tmp_image_ds_loc),
str(converted_image_ds_loc))
self._delete_datastore_file(vi.instance, str(tmp_image_ds_loc),
vi.dc_info.ref)
self._delete_datastore_file(str(tmp_image_ds_loc), vi.dc_info.ref)
self._move_to_cache(vi.dc_info.ref,
tmp_image_ds_loc.parent,
@@ -424,8 +422,7 @@ class VMwareVMOps(object):
LOG.debug("Caching image")
image_cache(vi, tmp_image_ds_loc)
LOG.debug("Cleaning up location %s", str(tmp_dir_loc))
self._delete_datastore_file(vi.instance, str(tmp_dir_loc),
vi.dc_info.ref)
self._delete_datastore_file(str(tmp_dir_loc), vi.dc_info.ref)
def spawn(self, context, instance, image_meta, injected_files,
admin_password, network_info, block_device_info=None,
@@ -714,7 +711,7 @@ class VMwareVMOps(object):
# is retained too by design since it makes little sense to remove
# it when the data disk it refers to still lingers.
for f in dest_vmdk_data_file_path, dest_vmdk_file_path:
self._delete_datastore_file(instance, f, dc_info.ref)
self._delete_datastore_file(f, dc_info.ref)
_clean_temp_data()