From e77208e110b2e70659570c5021f629a8c3b24569 Mon Sep 17 00:00:00 2001 From: Nitin Madhok Date: Wed, 8 Apr 2015 09:23:17 -0400 Subject: [PATCH] Listing datastore information as well for each hard disk --- salt/cloud/clouds/vmware.py | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/salt/cloud/clouds/vmware.py b/salt/cloud/clouds/vmware.py index f8f74967aa..7359b76ba6 100644 --- a/salt/cloud/clouds/vmware.py +++ b/salt/cloud/clouds/vmware.py @@ -737,14 +737,26 @@ def show_instance(name, call=None): if hasattr(device.backing, 'fileName'): device_full_info[device.deviceInfo.label]['capacityInKB'] = device.capacityInKB device_full_info[device.deviceInfo.label]['diskMode'] = device.backing.diskMode - disk_full_info[device.deviceInfo.label] = device_full_info[device.deviceInfo.label] - disk_full_info[device.deviceInfo.label]['descriptor'] = device.backing.fileName + disk_full_info[device.deviceInfo.label] = device_full_info[device.deviceInfo.label].copy() + disk_full_info[device.deviceInfo.label]['fileName'] = device.backing.fileName + if device.backing.datastore: + disk_full_info[device.deviceInfo.label]['datastore'] = { + 'name': device.backing.datastore.name, + 'host': [host.key.name for host in device.backing.datastore.host], + 'summary': { + 'capacityInKB': device.backing.datastore.summary.capacity, + 'freeSpaceInKB': device.backing.datastore.summary.freeSpace, + 'fileSystem': device.backing.datastore.summary.type, + 'url': device.backing.datastore.summary.url + } + } - storage_full_info = {} - storage_full_info['committed'] = vm.summary.storage.committed - storage_full_info['uncommitted'] = vm.summary.storage.uncommitted - storage_full_info['unshared'] = vm.summary.storage.unshared - storage_full_info['disks'] = disk_full_info + storage_full_info = { + 'committed': vm.summary.storage.committed, + 'uncommitted': vm.summary.storage.uncommitted, + 'unshared': vm.summary.storage.unshared, + 'disks': disk_full_info, + } file_full_info = {} for file in vm.layoutEx.file: