def set_autostart(vm_, state='on'):

    dom = _get_domain(vm_)

    if state == 'on':
        return dom.setAutostart(1) == 0

    elif state == 'off':
        return dom.setAutostart(0) == 0

    else:
        # return False if state is set to something other then on or off
        return False
Set the autostart flag on a VM so that the VM will start with the host
dataset/ETHPy150Open saltstack/salt/salt/modules/virt.py/set_autostart