diff options
| author | sateesh <sateesh.chodapuneedi@citrix.com> | 2011-02-24 11:55:25 +0530 |
|---|---|---|
| committer | sateesh <sateesh.chodapuneedi@citrix.com> | 2011-02-24 11:55:25 +0530 |
| commit | 4a002ffdc1937856de7dbf35b83ae0dd78dfe4c6 (patch) | |
| tree | 0290f69f364f895c3856b3a8fc4e50f3d9a880f3 | |
| parent | c0d3b8415ed34c6b259e183a047ca37c9598ffd4 (diff) | |
| download | nova-4a002ffdc1937856de7dbf35b83ae0dd78dfe4c6.tar.gz nova-4a002ffdc1937856de7dbf35b83ae0dd78dfe4c6.tar.xz nova-4a002ffdc1937856de7dbf35b83ae0dd78dfe4c6.zip | |
Fixed problems found in localized string formatting. Verified the fixes by running ./run_tests.sh -V.
| -rw-r--r-- | nova/virt/vmwareapi/io_util.py | 6 | ||||
| -rw-r--r-- | nova/virt/vmwareapi/vmops.py | 67 | ||||
| -rw-r--r-- | nova/virt/vmwareapi/vmware_images.py | 4 | ||||
| -rw-r--r-- | nova/virt/vmwareapi_conn.py | 15 |
4 files changed, 59 insertions, 33 deletions
diff --git a/nova/virt/vmwareapi/io_util.py b/nova/virt/vmwareapi/io_util.py index 6761d894c..b9645e220 100644 --- a/nova/virt/vmwareapi/io_util.py +++ b/nova/virt/vmwareapi/io_util.py @@ -131,8 +131,10 @@ class IOThread(Thread): if not self.transfer_size is None:
if self.read_size < self.transfer_size:
- raise IOError(_("Not enough data (%d of %d bytes)") % \
- (self.read_size, self.transfer_size))
+ raise IOError(_("Not enough data (%(read_size)d of "
+ "%(transfer_size)d bytes)") %
+ {'read_size': self.read_size,
+ 'transfer_size': self.transfer_size})
except Exception:
self._error = True
diff --git a/nova/virt/vmwareapi/vmops.py b/nova/virt/vmwareapi/vmops.py index da22588e3..3e32fceef 100644 --- a/nova/virt/vmwareapi/vmops.py +++ b/nova/virt/vmwareapi/vmops.py @@ -181,9 +181,12 @@ class VMWareVMOps(object): #depend on the size of the disk, thin/thick provisioning and the
#storage adapter type.
#Here we assume thick provisioning and lsiLogic for the adapter type
- LOG.debug(_("Creating Virtual Disk of size %sKB and adapter type %s on"
- " the ESX host local store %s ") % \
- (vmdk_file_size_in_kb, adapter_type, data_store_name))
+ LOG.debug(_("Creating Virtual Disk of size %(vmdk_file_size_in_kb)sKB"
+ " and adapter type %(adapter_type)s on"
+ " the ESX host local store %(data_store_name)s") %
+ {'vmdk_file_size_in_kb': vmdk_file_size_in_kb,
+ 'adapter_type': adapter_type,
+ 'data_store_name': data_store_name})
vmdk_create_spec = vm_util.get_vmdk_create_spec(vmdk_file_size_in_kb,
adapter_type)
vmdk_create_task = self._session._call_method(self._session._get_vim(),
@@ -193,22 +196,30 @@ class VMWareVMOps(object): datacenter=self._get_datacenter_name_and_ref()[0],
spec=vmdk_create_spec)
self._session._wait_for_task(instance.id, vmdk_create_task)
- LOG.debug(_("Created Virtual Disk of size %s KB on the ESX host local"
- "store %s ") % (vmdk_file_size_in_kb, data_store_name))
-
- LOG.debug(_("Deleting the file %s on the ESX host local"
- "store %s ") % (flat_uploaded_vmdk_path, data_store_name))
+ LOG.debug(_("Created Virtual Disk of size %(vmdk_file_size_in_kb)s KB"
+ " on the ESX host local store %(data_store_name)s ") %
+ {'vmdk_file_size_in_kb': vmdk_file_size_in_kb,
+ 'data_store_name': data_store_name})
+
+ LOG.debug(_("Deleting the file %(flat_uploaded_vmdk_path)s on "
+ "the ESX host local store %(data_store_names)s") %
+ {'flat_uploaded_vmdk_path': flat_uploaded_vmdk_path,
+ 'data_store_name': data_store_name})
#Delete the -flat.vmdk file created. .vmdk file is retained.
vmdk_delete_task = self._session._call_method(self._session._get_vim(),
"DeleteDatastoreFile_Task",
self._session._get_vim().get_service_content().FileManager,
name=flat_uploaded_vmdk_path)
self._session._wait_for_task(instance.id, vmdk_delete_task)
- LOG.debug(_("Deleted the file %s on the ESX host local"
- "store %s ") % (flat_uploaded_vmdk_path, data_store_name))
-
- LOG.debug(_("Downloading image file %s to the ESX data store %s ") % \
- (instance.image_id, data_store_name))
+ LOG.debug(_("Deleted the file %(flat_uploaded_vmdk_path)s on "
+ "the ESX host local store %(data_store_name)s ") %
+ {'flat_uploaded_vmdk_path': flat_uploaded_vmdk_path,
+ 'data_store_name': data_store_name})
+
+ LOG.debug(_("Downloading image file %(image_id)s to the "
+ "ESX data store %(datastore_name)s ") %
+ {'image_id': instance.image_id,
+ 'data_store_name': data_store_name})
# Upload the -flat.vmdk file whose meta-data file we just created above
vmware_images.fetch_image(
instance.image_id,
@@ -218,8 +229,10 @@ class VMWareVMOps(object): datastore_name=data_store_name,
cookies=self._session._get_vim().proxy.binding.cookies,
file_path=flat_uploaded_vmdk_name)
- LOG.debug(_("Downloaded image file %s to the ESX data store %s ") % \
- (instance.image_id, data_store_name))
+ LOG.debug(_("Downloaded image file %(image_id)s to the ESX data "
+ "store %(data_store_name)s ") %
+ {'image_id': instance.image_id,
+ 'data_store_name': data_store_name})
#Attach the vmdk uploaded to the VM. VM reconfigure is done to do so.
vmdk_attach_config_spec = vm_util.get_vmdk_attach_config_sepc(
@@ -442,16 +455,20 @@ class VMWareVMOps(object): dir_ds_compliant_path = vm_util.build_datastore_path(
datastore_name,
os.path.dirname(vmx_file_path))
- LOG.debug(_("Deleting contents of the VM %s from "
- "datastore %s") % (instance.name, datastore_name))
+ LOG.debug(_("Deleting contents of the VM %(instance.name)s "
+ "from datastore %(datastore_name)s") %
+ {('instance.name': instance.name,
+ 'datastore_name': datastore_name)})
delete_task = self._session._call_method(
self._session._get_vim(),
"DeleteDatastoreFile_Task",
self._session._get_vim().get_service_content().FileManager,
name=dir_ds_compliant_path)
self._session._wait_for_task(instance.id, delete_task)
- LOG.debug(_("Deleted contents of the VM %s from "
- "datastore %s") % (instance.name, datastore_name))
+ LOG.debug(_("Deleted contents of the VM %(instance_name)s "
+ "from datastore %(datastore_name)s") %
+ {'instance_name': instance.name,
+ 'datastore_name': datastore_name})
except Exception, excep:
LOG.warn(_("In vmwareapi:vmops:destroy, "
"got this exception while deleting"
@@ -570,14 +587,18 @@ class VMWareVMOps(object): instance['id'])
machine_id_chanfge_spec = vm_util.get_machine_id_change_spec(mac_addr,
ip_addr, net_mask, gateway)
- LOG.debug(_("Reconfiguring VM instance %s to set the machine id "
- "with ip - %s") % (instance.name, ip_addr))
+ LOG.debug(_("Reconfiguring VM instance %(instance_name)s to set "
+ "the machine id with ip - %(ip_addr)s") %
+ {'instance_name': instance.name,
+ 'ip_addr': ip_addr})
reconfig_task = self._session._call_method(self._session._get_vim(),
"ReconfigVM_Task", vm_ref,
spec=machine_id_chanfge_spec)
self._session._wait_for_task(instance.id, reconfig_task)
- LOG.debug(_("Reconfigured VM instance %s to set the machine id "
- "with ip - %s") % (instance.name, ip_addr))
+ LOG.debug(_("Reconfigured VM instance %(instance_name)s to set "
+ "the machine id with ip - %(ip_addr)s") %
+ {'instance_name': instance.name,
+ 'ip_addr': ip_addr})
def _create_dummy_vm_for_test(self, instance):
"""Create a dummy VM for testing purpose"""
diff --git a/nova/virt/vmwareapi/vmware_images.py b/nova/virt/vmwareapi/vmware_images.py index 78bbb7fec..4aad657e6 100644 --- a/nova/virt/vmwareapi/vmware_images.py +++ b/nova/virt/vmwareapi/vmware_images.py @@ -238,5 +238,7 @@ def get_vmdk_size_and_properties(image, instance): size = read_file_handle.get_size()
properties = read_file_handle.get_image_properties()
read_file_handle.close()
- LOG.debug(_("Got image size of %s for the image %s") % (size, image))
+ LOG.debug(_("Got image size of %(size)s for the image %(image)s") %
+ {'size': size,
+ 'image': image})
return size, properties
diff --git a/nova/virt/vmwareapi_conn.py b/nova/virt/vmwareapi_conn.py index 739cb53c7..29748fe81 100644 --- a/nova/virt/vmwareapi_conn.py +++ b/nova/virt/vmwareapi_conn.py @@ -335,17 +335,18 @@ class VMWareAPISession(object): TaskState.TASK_RUNNING]:
return
elif task_info.State == TaskState.TASK_SUCCESS:
- LOG.info(_("Task [%s] %s status: success ") % (
- task_name,
- str(task_ref)))
+ LOG.info(_("Task [%(taskname)s] %(taskref)s status: success") %
+ {'taskname': task_name,
+ 'taskref': str(task_ref)})
done.send(TaskState.TASK_SUCCESS)
else:
error_info = str(task_info.Error.LocalizedMessage)
action["error"] = error_info
- LOG.info(_("Task [%s] %s status: error [%s]") % (
- task_name,
- str(task_ref),
- error_info))
+ LOG.info(_("Task [%(task_name)s] %(task_ref)s status: "
+ "error [%(error_info)s]") %
+ {'task_name': task_name,
+ 'task_ref': str(task_ref),
+ 'error_info': error_info})
done.send_exception(Exception(error_info))
db.instance_action_create(context.get_admin_context(), action)
except Exception, excep:
|
