Hi Team, I am using libvirt module to retrieve configuration of the virtual machines, Can you please tell me how to retrieve the disk space of the Virtual machines. In my KVM hyper i am running two virtual machines. Regards Manzoor
On 09/13/2013 01:26 AM, Manzoor Ahamed wrote:> Hi Team, > > I am using libvirt module to retrieve configuration of the virtual > machines, Can you please tell me how to retrieve the disk space of the > Virtual machines. In my KVM hyper i am running two virtual machines.virDomainGetBlockInfo tells you how much host resources the guest disk is using, but to find out from the guest itself how much the guest thinks it has free, you'd have to add a new guest agent command. -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
You can get the block devices assigned to a VM with the following.. virsh domblklist <machine> Target Source ------------------------------------------------ vda /VirtualMachines/KVM/machine.qcow2 hdc /VirtualMachines/iso/gparted-live-0.12.1-1.iso For more detailed info, you can use qemu-img on the above returned block device qemu-img info /VirtualMachines/KVM/machine.qcow2 image: /VirtualMachines/KVM/machine.qcow2 file format: qcow2 virtual size: 250G (268435456000 bytes) disk size: 174G cluster_size: 65536 HTH, -Adam From: libvirt-users-bounces@redhat.com [mailto:libvirt-users-bounces@redhat.com] On Behalf Of Manzoor Ahamed Sent: Friday, September 13, 2013 2:26 AM To: libvirt-users@redhat.com Subject: [libvirt-users] Regarding libvirt usage Hi Team, I am using libvirt module to retrieve configuration of the virtual machines, Can you please tell me how to retrieve the disk space of the Virtual machines. In my KVM hyper i am running two virtual machines. Regards Manzoor
Hi Adam, Thanks for the reply. qemu-img info /VirtualMachines/KVM/machine.qcow2**** image: /VirtualMachines/KVM/machine.qcow2**** file format: qcow2**** virtual size: 250G (268435456000 bytes)**** disk size: 174G** cluster_size: 65536 How can i do this from remote host using libvirt module ? Started using and learning libvirt so dont know how to execute it . Thanks in advance. Regards Manzoor On Fri, Sep 13, 2013 at 9:21 PM, vonNieda, Adam (USMS) < Adam.vonNieda@usdoj.gov> wrote:> ** ** > > You can get the block devices assigned to a VM with the following..**** > > ** ** > > virsh domblklist <machine>**** > > Target Source**** > > ------------------------------------------------**** > > vda /VirtualMachines/KVM/machine.qcow2**** > > hdc /VirtualMachines/iso/gparted-live-0.12.1-1.iso**** > > ** ** > > For more detailed info, you can use qemu-img on the above returned block > device**** > > ** ** > > qemu-img info /VirtualMachines/KVM/machine.qcow2**** > > image: /VirtualMachines/KVM/machine.qcow2**** > > file format: qcow2**** > > virtual size: 250G (268435456000 bytes)**** > > disk size: 174G**** > > cluster_size: 65536**** > > ** ** > > HTH, **** > > ** ** > > -Adam**** > > ** ** > > *From:* libvirt-users-bounces@redhat.com [mailto: > libvirt-users-bounces@redhat.com] *On Behalf Of *Manzoor Ahamed > *Sent:* Friday, September 13, 2013 2:26 AM > *To:* libvirt-users@redhat.com > *Subject:* [libvirt-users] Regarding libvirt usage**** > > ** ** > > Hi Team,**** > > ** ** > > I am using libvirt module to retrieve configuration of the virtual > machines, Can you please tell me how to retrieve the disk space of the > Virtual machines. In my KVM hyper i am running two virtual machines.**** > > ** ** > > Regards**** > > Manzoor**** >