Powers on a virtual machine specified by it's name.

    name
        Name of the virtual machine

    datacenter
        Datacenter of the virtual machine

    service_instance
        Service instance (vim.ServiceInstance) of the vCenter.
        Default is None.

    .. code-block:: bash

        salt '*' vsphere.power_on_vm name=my_vm

def power_on_vm(name, datacenter=None, service_instance=None):
    '''
    Powers on a virtual machine specified by it's name.

    name
        Name of the virtual machine

    datacenter
        Datacenter of the virtual machine

    service_instance
        Service instance (vim.ServiceInstance) of the vCenter.
        Default is None.

    .. code-block:: bash

        salt '*' vsphere.power_on_vm name=my_vm

    '''
    log.trace('Powering on virtual machine %s', name)
    vm_properties = [
        'name',
        'summary.runtime.powerState'
    ]
    virtual_machine = salt.utils.vmware.get_vm_by_property(
        service_instance,
        name,
        datacenter=datacenter,
        vm_properties=vm_properties)
    if virtual_machine['summary.runtime.powerState'] == 'poweredOn':
        result = {'comment': 'Virtual machine is already powered on',
                  'changes': {'power_on': True}}
        return result
    salt.utils.vmware.power_cycle_vm(virtual_machine['object'], action='on')
    result = {'comment': 'Virtual machine power on action succeeded',
              'changes': {'power_on': True}}
    return result