Re: how to know one domain is defined or not

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





2013/1/17 Michal Privoznik <mprivozn@xxxxxxxxxx>
On 17.01.2013 10:37, lei yang wrote:
> Hi experts
>
> I want to write a script to determine one domain named "vm1" is
> defined or not, if defined, I will undefine it.
>
> The question is how could I know it define or not ?

either you can 'virsh list --persistent --all | grep $vm' or you can try
'virsh undefine $vm' which will throw an error if there's no such domain
as $vm.

I think ‘virsh domstate $vm’ is better than 'list --all | grep $vm'   

_______________________________________________
libvirt-users mailing list
libvirt-users@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvirt-users

[Index of Archives]     [Virt Tools]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [KDE Users]

  Powered by Linux