In virsh how do I see which domains are marked as autostart? virsh list does not show which domains are marked as autostart.
3 Answers
From the man page:-
virsh list --autostart
should do it.
- 
        Running 'virsh list --help' on a CentOS install shows '--autostart' as an option. The virsh installed is version 0.10.2 and it's the same version for libvirt.garethTheRed– garethTheRed2014-06-17 15:15:31 +00:00Commented Jun 17, 2014 at 15:15
 - 
        1Debian Wheezy is on 0.9.12 which may explain it.garethTheRed– garethTheRed2014-06-17 17:46:15 +00:00Commented Jun 17, 2014 at 17:46
 - 
        4Use
--allto include stopped domains as well. E.g.sudo virsh list --autostart --allMohnish– Mohnish2016-06-22 03:14:45 +00:00Commented Jun 22, 2016 at 3:14 
I realize this is a very old thread - on my RHEL6.5 system, this works, with the usual caveat that if you don't say --all, virsh list will only list info for running domains. 
So try
virsh list --all --autostart
and/or
virsh list --all --no-autostart
Works for me.
Here is a universal script for getting autostart information. To list domains (VMs) that have autostart enable put in virsh_autostart_info.sh and run:
virsh_autostart_info.sh | grep -i enabled. You could of course clear it up to just display names or whatever you want.
##
# Configuration
#
VIRSH=/usr/bin/virsh
##
# Simple list of domains (VMs)
#
list_domains() {
    # list, skipping headers, capturing number and domName, and then strip Id and State column
    $VIRSH list --all | awk '$1 == "-" || $1+0 > 0 { print $2 }'
}
##
# Processing
#
## full info
#echo ""
#list_domains | while read vmName; do
#    $VIRSH dominfo $vmName
#done
# just autostart info
echo ""
list_domains | while read vmName; do
    autostartStatus=`$VIRSH dominfo $vmName | grep -i autostart`
    echo $vmName $autostartStatus
done
    - 
        
virsh list --autostartdidn't work for me in centos 6.5Ismail Faruqi– Ismail Faruqi2015-07-31 07:04:41 +00:00Commented Jul 31, 2015 at 7:04 - 
        Thx for the script, it pointed me in the right direction. For anyone needeing a simple command here it is:
virsh dominfo $VM_NAME | grep -i autostartwill showAutostart: enable; you can disable withvirsh autostart --disable $VM_NAME, and now the output will be:Autostart: disableRaZ– RaZ2022-09-28 10:01:51 +00:00Commented Sep 28, 2022 at 10:01