Creates a virtual machine with the given properties if it doesn't exist.

def vm_created(name, vm_name, cpu, memory, image, version, interfaces,
               disks, scsi_devices, serial_ports, datacenter, datastore,
               placement, ide_controllers=None, sata_controllers=None,
               cd_dvd_drives=None, advanced_configs=None, power_on=False):
    '''
    Creates a virtual machine with the given properties if it doesn't exist.
    '''
    result = {'name': name,
              'result': None,
              'changes': {},
              'comment': ''}

    if __opts__['test']:
        result['comment'] = 'Virtual machine {0} will be created'.format(
                vm_name)
        return result

    service_instance = __salt__['vsphere.get_service_instance_via_proxy']()
    try:
        info = __salt__['vsphere.create_vm'](vm_name, cpu, memory, image,
                                             version, datacenter, datastore,
                                             placement, interfaces, disks,
                                             scsi_devices,
                                             serial_ports=serial_ports,
                                             ide_controllers=ide_controllers,
                                             sata_controllers=sata_controllers,
                                             cd_drives=cd_dvd_drives,
                                             advanced_configs=advanced_configs,
                                             service_instance=service_instance)
    except salt.exceptions.CommandExecutionError as exc:
        log.error('Error: %s', exc)
        if service_instance:
            __salt__['vsphere.disconnect'](service_instance)
        result.update({
            'result': False,
            'comment': six.text_type(exc)})
        return result

    if power_on:
        try:
            __salt__['vsphere.power_on_vm'](vm_name, datacenter,
                                            service_instance=service_instance)
        except salt.exceptions.VMwarePowerOnError as exc:
            log.error('Error: %s', exc)
            if service_instance:
                __salt__['vsphere.disconnect'](service_instance)
            result.update({
                'result': False,
                'comment': six.text_type(exc)})
            return result
        info['power_on'] = power_on

    changes = {'name': vm_name, 'info': info}
    __salt__['vsphere.disconnect'](service_instance)
    result = {'name': name,
              'result': True,
              'changes': changes,
              'comment': 'Virtual machine '
                         '{0} created successfully'.format(vm_name)}

    return result