summaryrefslogtreecommitdiff
path: root/nova/virt/vmwareapi/ds_util.py
diff options
context:
space:
mode:
authorVui Lam <vui@vmware.com>2014-06-06 03:10:49 -0700
committerMatthew Booth <mbooth@redhat.com>2014-07-17 11:49:26 +0100
commit4be42a7f62f5b8f97e2cbdb0ad8f67c81601d682 (patch)
treec24c32191ffb2ea3247ac39b03911a60fda70432 /nova/virt/vmwareapi/ds_util.py
parentc0244717973d70c1d9795756b729aa6a098513a1 (diff)
downloadnova-4be42a7f62f5b8f97e2cbdb0ad8f67c81601d682.tar.gz
VMware: use datastore classes in file_move/delete/exists, mkdir
Straightforward conversion of a few functions in ds_util to accepts DatastorePath objects instead of literal strings. partial blueprint vmware-spawn-refactor Change-Id: I9dff390ce020dcc39a05184a7ee69902e3412c9f
Diffstat (limited to 'nova/virt/vmwareapi/ds_util.py')
-rw-r--r--nova/virt/vmwareapi/ds_util.py14
1 files changed, 7 insertions, 7 deletions
diff --git a/nova/virt/vmwareapi/ds_util.py b/nova/virt/vmwareapi/ds_util.py
index f06584dbbc..01176b2096 100644
--- a/nova/virt/vmwareapi/ds_util.py
+++ b/nova/virt/vmwareapi/ds_util.py
@@ -320,14 +320,14 @@ def get_available_datastores(session, cluster=None, datastore_regex=None):
return allowed
-def file_delete(session, datastore_path, dc_ref):
- LOG.debug("Deleting the datastore file %s", datastore_path)
+def file_delete(session, ds_path, dc_ref):
+ LOG.debug("Deleting the datastore file %s", ds_path)
vim = session._get_vim()
file_delete_task = session._call_method(
session._get_vim(),
"DeleteDatastoreFile_Task",
vim.get_service_content().fileManager,
- name=datastore_path,
+ name=str(ds_path),
datacenter=dc_ref)
session._wait_for_task(file_delete_task)
LOG.debug("Deleted the datastore file")
@@ -362,9 +362,9 @@ def file_move(session, dc_ref, src_file, dst_file):
session._get_vim(),
"MoveDatastoreFile_Task",
vim.get_service_content().fileManager,
- sourceName=src_file,
+ sourceName=str(src_file),
sourceDatacenter=dc_ref,
- destinationName=dst_file,
+ destinationName=str(dst_file),
destinationDatacenter=dc_ref)
session._wait_for_task(move_task)
LOG.debug("File moved")
@@ -384,7 +384,7 @@ def file_exists(session, ds_browser, ds_path, file_name):
search_task = session._call_method(session._get_vim(),
"SearchDatastore_Task",
ds_browser,
- datastorePath=ds_path,
+ datastorePath=str(ds_path),
searchSpec=search_spec)
try:
task_info = session._wait_for_task(search_task)
@@ -404,7 +404,7 @@ def mkdir(session, ds_path, dc_ref):
LOG.debug("Creating directory with path %s", ds_path)
session._call_method(session._get_vim(), "MakeDirectory",
session._get_vim().get_service_content().fileManager,
- name=ds_path, datacenter=dc_ref,
+ name=str(ds_path), datacenter=dc_ref,
createParentDirectories=True)
LOG.debug("Created directory with path %s", ds_path)