vsphere_guest: add power status to facts

This commit is contained in:
luto 2015-11-02 17:48:37 +01:00 committed by Matt Clay
parent 40e7ed9518
commit d20c4368d2

View file

@ -270,9 +270,23 @@ EXAMPLES = '''
hw_guest_id: "rhel6_64Guest" hw_guest_id: "rhel6_64Guest"
hw_memtotal_mb: 2048 hw_memtotal_mb: 2048
hw_name: "centos64Guest" hw_name: "centos64Guest"
hw_power_status: "POWERED ON",
hw_processor_count: 2 hw_processor_count: 2
hw_product_uuid: "ef50bac8-2845-40ff-81d9-675315501dac" hw_product_uuid: "ef50bac8-2845-40ff-81d9-675315501dac"
hw_power_status will be one of the following values:
- POWERED ON
- POWERED OFF
- SUSPENDED
- POWERING ON
- POWERING OFF
- SUSPENDING
- RESETTING
- BLOCKED ON MSG
- REVERTING TO SNAPSHOT
- UNKNOWN
as seen in the VMPowerState-Class of PySphere: http://git.io/vlwOq
# Remove a vm from vSphere # Remove a vm from vSphere
# The VM must be powered_off or you need to use force to force a shutdown # The VM must be powered_off or you need to use force to force a shutdown
@ -1401,6 +1415,7 @@ def gather_facts(vm):
facts = { facts = {
'module_hw': True, 'module_hw': True,
'hw_name': vm.properties.name, 'hw_name': vm.properties.name,
'hw_power_status': vm.get_status(),
'hw_guest_full_name': vm.properties.config.guestFullName, 'hw_guest_full_name': vm.properties.config.guestFullName,
'hw_guest_id': vm.properties.config.guestId, 'hw_guest_id': vm.properties.config.guestId,
'hw_product_uuid': vm.properties.config.uuid, 'hw_product_uuid': vm.properties.config.uuid,