Merge branch '2015.5' of https://github.com/saltstack/salt into fix_25352

This commit is contained in:
twangboy 2015-07-23 15:01:22 -06:00
commit 7a71f5ea6a
2 changed files with 107 additions and 94 deletions

View file

@ -16,7 +16,7 @@ The easiest way to install a release candidate of Salt is using
.. code-block:: bash
curl -o install_salt.sh -L https://bootstrap.saltstack.com
sudo sh install_salt.sh git v2015.8.0rc1
sudo sh install_salt.sh git v2015.8.0rc2
If you want to also install a master using `Salt Bootstrap`_, use the ``-M``
flag:
@ -24,7 +24,7 @@ flag:
.. code-block:: bash
curl -o install_salt.sh -L https://bootstrap.saltstack.com
sudo sh install_salt.sh -M git v2015.8.0rc1
sudo sh install_salt.sh -M git v2015.8.0rc2
If you want to install only a master and not a minion using `Salt Bootstrap`_,
use the ``-M`` and ``-N`` flags:
@ -32,7 +32,7 @@ use the ``-M`` and ``-N`` flags:
.. code-block:: bash
curl -o install_salt.sh -L https://bootstrap.saltstack.com
sudo sh install_salt.sh -M -N git v2015.8.0rc1
sudo sh install_salt.sh -M -N git v2015.8.0rc2
Installation from Source Tarball
@ -44,9 +44,9 @@ installation docs <_installation>`. Then install salt using the following:
.. code-block:: bash
curl -O https://pypi.python.org/packages/source/s/salt/salt-2015.8.0rc1.tar.gz
tar -xzvf salt-2015.8.0rc1.tar.gz
cd salt-2015.8.0rc1
curl -O https://pypi.python.org/packages/source/s/salt/salt-2015.8.0rc2.tar.gz
tar -xzvf salt-2015.8.0rc2.tar.gz
cd salt-2015.8.0rc2
sudo python setup.py install

View file

@ -843,22 +843,24 @@ def _format_instance_info_select(vm, selection):
vm_select_info['id'] = vm["name"]
if 'image' in selection:
vm_select_info['image'] = "{0} (Detected)".format(vm["config.guestFullName"])
vm_select_info['image'] = "{0} (Detected)".format(vm["config.guestFullName"]) if "config.guestFullName" in vm else "N/A"
if 'size' in selection:
vm_select_info['size'] = u"cpu: {0}\nram: {1}MB".format(vm["config.hardware.numCPU"], vm["config.hardware.memoryMB"])
cpu = vm["config.hardware.numCPU"] if "config.hardware.numCPU" in vm else "N/A"
ram = "{0} MB".format(vm["config.hardware.memoryMB"]) if "config.hardware.memoryMB" in vm else "N/A"
vm_select_info['size'] = u"cpu: {0}\nram: {1}".format(cpu, ram)
if 'state' in selection:
vm_select_info['state'] = str(vm["summary.runtime.powerState"])
vm_select_info['state'] = str(vm["summary.runtime.powerState"]) if "summary.runtime.powerState" in vm else "N/A"
if 'guest_id' in selection:
vm_select_info['guest_id'] = vm["config.guestId"]
vm_select_info['guest_id'] = vm["config.guestId"] if "config.guestId" in vm else "N/A"
if 'hostname' in selection:
vm_select_info['hostname'] = vm["object"].guest.hostName
if 'path' in selection:
vm_select_info['path'] = vm["config.files.vmPathName"]
vm_select_info['path'] = vm["config.files.vmPathName"] if "config.files.vmPathName" in vm else "N/A"
if 'tools_status' in selection:
vm_select_info['tools_status'] = str(vm["guest.toolsStatus"]) if "guest.toolsStatus" in vm else "N/A"
@ -868,14 +870,15 @@ def _format_instance_info_select(vm, selection):
ip_addresses = []
mac_addresses = []
for net in vm["guest.net"]:
network_full_info[net.network] = {
'connected': net.connected,
'ip_addresses': net.ipAddress,
'mac_address': net.macAddress
}
ip_addresses.extend(net.ipAddress)
mac_addresses.append(net.macAddress)
if "guest.net" in vm:
for net in vm["guest.net"]:
network_full_info[net.network] = {
'connected': net.connected,
'ip_addresses': net.ipAddress,
'mac_address': net.macAddress
}
ip_addresses.extend(net.ipAddress)
mac_addresses.append(net.macAddress)
if 'private_ips' in selection:
vm_select_info['private_ips'] = ip_addresses
@ -888,6 +891,63 @@ def _format_instance_info_select(vm, selection):
if 'devices' in selection:
device_full_info = {}
if "config.hardware.device" in vm:
for device in vm["config.hardware.device"]:
device_full_info[device.deviceInfo.label] = {
'key': device.key,
'label': device.deviceInfo.label,
'summary': device.deviceInfo.summary,
'type': type(device).__name__.rsplit(".", 1)[1],
'unitNumber': device.unitNumber
}
if hasattr(device.backing, 'network'):
device_full_info[device.deviceInfo.label]['addressType'] = device.addressType
device_full_info[device.deviceInfo.label]['macAddress'] = device.macAddress
if hasattr(device, 'busNumber'):
device_full_info[device.deviceInfo.label]['busNumber'] = device.busNumber
if hasattr(device, 'device'):
device_full_info[device.deviceInfo.label]['devices'] = device.device
if hasattr(device, 'videoRamSizeInKB'):
device_full_info[device.deviceInfo.label]['videoRamSizeInKB'] = device.videoRamSizeInKB
if isinstance(device, vim.vm.device.VirtualDisk):
device_full_info[device.deviceInfo.label]['capacityInKB'] = device.capacityInKB
device_full_info[device.deviceInfo.label]['diskMode'] = device.backing.diskMode
device_full_info[device.deviceInfo.label]['fileName'] = device.backing.fileName
vm_select_info['devices'] = device_full_info
if 'storage' in selection:
storage_full_info = {
'committed': int(vm["summary.storage.committed"]) if "summary.storage.committed" in vm else "N/A",
'uncommitted': int(vm["summary.storage.uncommitted"]) if "summary.storage.uncommitted" in vm else "N/A",
'unshared': int(vm["summary.storage.unshared"]) if "summary.storage.unshared" in vm else "N/A"
}
vm_select_info['storage'] = storage_full_info
if 'files' in selection:
file_full_info = {}
if "layoutEx.file" in file:
for file in vm["layoutEx.file"]:
file_full_info[file.key] = {
'key': file.key,
'name': file.name,
'size': file.size,
'type': file.type
}
vm_select_info['files'] = file_full_info
return vm_select_info
def _format_instance_info(vm):
device_full_info = {}
if "config.hardware.device" in vm:
for device in vm["config.hardware.device"]:
device_full_info[device.deviceInfo.label] = {
'key': device.key,
@ -915,18 +975,14 @@ def _format_instance_info_select(vm, selection):
device_full_info[device.deviceInfo.label]['diskMode'] = device.backing.diskMode
device_full_info[device.deviceInfo.label]['fileName'] = device.backing.fileName
vm_select_info['devices'] = device_full_info
storage_full_info = {
'committed': int(vm["summary.storage.committed"]) if "summary.storage.committed" in vm else "N/A",
'uncommitted': int(vm["summary.storage.uncommitted"]) if "summary.storage.uncommitted" in vm else "N/A",
'unshared': int(vm["summary.storage.unshared"]) if "summary.storage.unshared" in vm else "N/A"
}
if 'storage' in selection:
storage_full_info = {
'committed': vm["summary.storage.committed"],
'uncommitted': vm["summary.storage.uncommitted"],
'unshared': vm["summary.storage.unshared"]
}
vm_select_info['storage'] = storage_full_info
if 'files' in selection:
file_full_info = {}
file_full_info = {}
if "layoutEx.file" in vm:
for file in vm["layoutEx.file"]:
file_full_info[file.key] = {
'key': file.key,
@ -934,82 +990,37 @@ def _format_instance_info_select(vm, selection):
'size': file.size,
'type': file.type
}
vm_select_info['files'] = file_full_info
return vm_select_info
def _format_instance_info(vm):
device_full_info = {}
for device in vm["config.hardware.device"]:
device_full_info[device.deviceInfo.label] = {
'key': device.key,
'label': device.deviceInfo.label,
'summary': device.deviceInfo.summary,
'type': type(device).__name__.rsplit(".", 1)[1],
'unitNumber': device.unitNumber
}
if hasattr(device.backing, 'network'):
device_full_info[device.deviceInfo.label]['addressType'] = device.addressType
device_full_info[device.deviceInfo.label]['macAddress'] = device.macAddress
if hasattr(device, 'busNumber'):
device_full_info[device.deviceInfo.label]['busNumber'] = device.busNumber
if hasattr(device, 'device'):
device_full_info[device.deviceInfo.label]['devices'] = device.device
if hasattr(device, 'videoRamSizeInKB'):
device_full_info[device.deviceInfo.label]['videoRamSizeInKB'] = device.videoRamSizeInKB
if isinstance(device, vim.vm.device.VirtualDisk):
device_full_info[device.deviceInfo.label]['capacityInKB'] = device.capacityInKB
device_full_info[device.deviceInfo.label]['diskMode'] = device.backing.diskMode
device_full_info[device.deviceInfo.label]['fileName'] = device.backing.fileName
storage_full_info = {
'committed': int(vm["summary.storage.committed"]),
'uncommitted': int(vm["summary.storage.uncommitted"]),
'unshared': int(vm["summary.storage.unshared"])
}
file_full_info = {}
for file in vm["layoutEx.file"]:
file_full_info[file.key] = {
'key': file.key,
'name': file.name,
'size': file.size,
'type': file.type
}
network_full_info = {}
ip_addresses = []
mac_addresses = []
for net in vm["guest.net"]:
network_full_info[net.network] = {
'connected': net.connected,
'ip_addresses': net.ipAddress,
'mac_address': net.macAddress
}
ip_addresses.extend(net.ipAddress)
mac_addresses.append(net.macAddress)
if "guest.net" in vm:
for net in vm["guest.net"]:
network_full_info[net.network] = {
'connected': net.connected,
'ip_addresses': net.ipAddress,
'mac_address': net.macAddress
}
ip_addresses.extend(net.ipAddress)
mac_addresses.append(net.macAddress)
cpu = vm["config.hardware.numCPU"] if "config.hardware.numCPU" in vm else "N/A"
ram = "{0} MB".format(vm["config.hardware.memoryMB"]) if "config.hardware.memoryMB" in vm else "N/A"
vm_full_info = {
'id': str(vm['name']),
'image': "{0} (Detected)".format(vm["config.guestFullName"]),
'size': u"cpu: {0}\nram: {1}MB".format(vm["config.hardware.numCPU"], vm["config.hardware.memoryMB"]),
'state': str(vm["summary.runtime.powerState"]),
'image': "{0} (Detected)".format(vm["config.guestFullName"]) if "config.guestFullName" in vm else "N/A",
'size': u"cpu: {0}\nram: {1}".format(cpu, ram),
'state': str(vm["summary.runtime.powerState"]) if "summary.runtime.powerState" in vm else "N/A",
'private_ips': ip_addresses,
'public_ips': [],
'devices': device_full_info,
'storage': storage_full_info,
'files': file_full_info,
'guest_id': str(vm["config.guestId"]),
'guest_id': str(vm["config.guestId"]) if "config.guestId" in vm else "N/A",
'hostname': str(vm["object"].guest.hostName),
'mac_address': mac_addresses,
'networks': network_full_info,
'path': str(vm["config.files.vmPathName"]),
'path': str(vm["config.files.vmPathName"]) if "config.files.vmPathName" in vm else "N/A",
'tools_status': str(vm["guest.toolsStatus"]) if "guest.toolsStatus" in vm else "N/A"
}
@ -1407,11 +1418,13 @@ def list_nodes(kwargs=None, call=None):
vm_list = _get_mors_with_properties(vim.VirtualMachine, vm_properties)
for vm in vm_list:
cpu = vm["config.hardware.numCPU"] if "config.hardware.numCPU" in vm else "N/A"
ram = "{0} MB".format(vm["config.hardware.memoryMB"]) if "config.hardware.memoryMB" in vm else "N/A"
vm_info = {
'id': vm["name"],
'image': "{0} (Detected)".format(vm["config.guestFullName"]),
'size': u"cpu: {0}\nram: {1}MB".format(vm["config.hardware.numCPU"], vm["config.hardware.memoryMB"]),
'state': str(vm["summary.runtime.powerState"]),
'image': "{0} (Detected)".format(vm["config.guestFullName"]) if "config.guestFullName" in vm else "N/A",
'size': u"cpu: {0}\nram: {1}".format(cpu, ram),
'state': str(vm["summary.runtime.powerState"]) if "summary.runtime.powerState" in vm else "N/A",
'private_ips': [vm["guest.ipAddress"]] if "guest.ipAddress" in vm else [],
'public_ips': []
}