Bug 477275 - virsh domblkstat gives wrong error message when the target device doesn't exist in the guest [NEEDINFO]
virsh domblkstat gives wrong error message when the target device doesn't exi...
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: libvirt (Show other bugs)
5.4
All Linux
low Severity low
: rc
: ---
Assigned To: Daniel Veillard
Virtualization Bugs
:
Depends On: 475821
Blocks:
  Show dependency treegraph
 
Reported: 2008-12-19 18:36 EST by Gurhan Ozen
Modified: 2013-11-03 20:38 EST (History)
5 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2009-09-02 05:23:00 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---
berrange: needinfo? (gozen)


Attachments (Terms of Use)

  None (edit)
Description Gurhan Ozen 2008-12-19 18:36:22 EST
Description of problem:

# virsh domblkstat rhel4.7_x86_64_pv_guest /dev/xvda
/dev/xvda rd_req 2069
/dev/xvda rd_bytes 37224960
/dev/xvda wr_req 1079
/dev/xvda wr_bytes 9521152
/dev/xvda errs 0

# virsh domblkstat rhel4.7_x86_64_pv_guest /dev/xvdh
libvir: Xen error : this function is not supported by the hypervisor: read_bd_stats: Failed to read any block statistics
error: Failed to get block stats rhel4.7_x86_64_pv_guest /dev/xvdh

It should probably rather say something like device "/dev/xvdh" doesn't exist, rather than saying that the hypervisor doesn't support the function.

Version-Release number of selected component (if applicable):
libvirt-0.3.3-14.el5

How reproducible:
Very.

Steps to Reproduce:
1. Try to get domblkstats for a device that doesn't exist in the guest.
2.
Comment 1 Cole Robinson 2009-02-15 20:11:41 EST
Seems to be addressed by this commit:

http://git.et.redhat.com/?p=libvirt.git;a=commit;h=d752194d0735c50acf75e75f40cc259fdc0ffd6c
Comment 2 Daniel Berrange 2009-03-30 07:07:57 EDT
With the 0.6.1 rebase this now gives a slightly better message: 

# virsh domblkstat rhel5pv /dev/xvdr
error: Failed to get block stats rhel5pv /dev/xvdr
error: internal error read_bd_stats: Failed to read any block statistics
Comment 3 Alex Jia 2009-04-22 03:00:57 EDT
the problem is still exist on RHEL5.3 machine.and 'virsh domblkstat' works for
xen PV block devices,but FV fail.
(kernel:2.6.18-128.1.6.el5xen;libvirt-0.6.2-1.el5)

for PV:
[root@dhcp-66-70-18 /]# virsh domblkstat test xvda
xvda rd_req 5539
xvda rd_bytes 153436160
xvda wr_req 1289
xvda wr_bytes 9679872
xvda errs 0

for FV:
[root@dhcp-66-70-18 domain]# virsh domblkstat test hda
error: Failed to get block stats test hda
error: internal error read_bd_stats: Frontend block device not connected
Comment 4 Alex Jia 2009-04-22 21:39:44 EDT
for comment #3:the bug is still exist now,need to modify.


the problem is still exist on RHEL5.3 machine.and 'virsh domblkstat' works for
xen PV block devices,but FV fail.
(kernel:2.6.18-128.1.6.el5xen;libvirt-0.6.2-1.el5)

for PV:
[root@dhcp-66-70-18 /]# virsh domblkstat test xvda
xvda rd_req 5539
xvda rd_bytes 153436160
xvda wr_req 1289
xvda wr_bytes 9679872
xvda errs 0

for FV:
[root@dhcp-66-70-18 domain]# virsh domblkstat test hda
error: Failed to get block stats test hda
error: internal error read_bd_stats: Frontend block device not connected
Comment 5 Daniel Berrange 2009-06-12 07:16:58 EDT
Does the fullyvirt guest have the paravirt drivers installed ?

The blockstats only work for HVM guests with PV drivers. If you are using IDE in the HVM guest, then it is expected behaviour to get an error for stats.
Comment 7 Daniel Berrange 2009-06-17 17:41:29 EDT
IMHO this bug is fixed. The original bug report was that this error message is wrong:

libvir: Xen error : this function is not supported by the hypervisor:


that error message has now been replaced by the real error message. So the fact that you get an error for HVM guests it not a problem - it is expected behaviour, and the message

error: internal error read_bd_stats: Frontend block device not connected  

accurately reflects what the problem is.
Comment 8 Alex Jia 2009-06-17 21:50:51 EDT
[root@dhcp-66-70-18 ~]# python
Python 2.4.3 (#1, Sep 17 2008, 16:07:08) 
[GCC 4.1.2 20071124 (Red Hat 4.1.2-41)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import libvirt
>>> conn=libvirt.open(None)
>>> dir(conn)
['__del__', '__doc__', '__init__', '__module__', '_o', 'close', 'createLinux', 'createXML', 'defineXML', 'dispatchDomainEventCallbacks', 'domainEventDeregister', 'domainEventRegister', 'findStoragePoolSources', 'getCapabilities', 'getCellsFreeMemory', 'getFreeMemory', 'getHostname', 'getInfo', 'getMaxVcpus', 'getType', 'getURI', 'listDefinedDomains', 'listDefinedNetworks', 'listDefinedStoragePools', 'listDevices', 'listDomainsID', 'listNetworks', 'listStoragePools', 'lookupByID', 'lookupByName', 'lookupByUUID', 'lookupByUUIDString', 'migrate', 'networkCreateXML', 'networkDefineXML', 'networkLookupByName', 'networkLookupByUUIDString', 'nodeDeviceLookupByName', 'numOfDefinedDomains', 'numOfDefinedNetworks', 'numOfDefinedStoragePools', 'numOfDevices', 'numOfDomains', 'numOfNetworks', 'numOfStoragePools', 'ref', 'restore', 'storagePoolCreateXML', 'storagePoolDefineXML', 'storagePoolLookupByName', 'storagePoolLookupByUUID', 'storagePoolLookupByUUIDString', 'storageVolLookupByKey', 'storageVolLookupByPath', 'virConnGetLastError', 'virConnResetLastError']
>>> dom=conn.lookupByName("winxp")
>>> dir(dom)
['ID', 'OSType', 'UUID', 'UUIDString', 'XMLDesc', '__del__', '__doc__', '__init__', '__module__', '_conn', '_o', 'attachDevice', 'autostart', 'blockPeek', 'blockStats', 'connect', 'coreDump', 'create', 'destroy', 'detachDevice', 'info', 'interfaceStats', 'maxMemory', 'maxVcpus', 'memoryPeek', 'migrate', 'name', 'pinVcpu', 'reboot', 'ref', 'resume', 'save', 'schedulerParameters', 'schedulerType', 'setAutostart', 'setMaxMemory', 'setMemory', 'setSchedulerParameters', 'setVcpus', 'shutdown', 'suspend', 'undefine', 'vcpus']
>>> xml=dom.XMLDesc(0)
>>> import libxml2
>>> doc = libxml2.parseDoc(xml)
>>> ctx = doc.xpathNewContext()
>>> devs = ctx.xpathEval("/domain/devices/interface/target/@dev")
>>> path = devs[0].content
>>> ifstats = dom.interfaceStats(path)
>>> print ifstats
(0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L)
>>> devs = ctx.xpathEval("/domain/devices/disk/target/@dev")
>>> path = devs[0].content
>>> blkstats = dom.blockStats(path)
libvir: Linux Stats error : internal error read_bd_stats: Frontend block device not connected
>>> print blkstats
None



[root@dhcp-66-70-18 ~]# uname -a
Linux dhcp-66-70-18.nay.redhat.com 2.6.18-153.el5xen #1 SMP Wed Jun 10 18:12:08 EDT 2009 x86_64 x86_64 x86_64 GNU/Linux
[root@dhcp-66-70-18 ~]# rpm -qa|grep libvirt
libvirt-cim-0.5.5-2.el5
libvirt-devel-0.6.3-10.el5
libvirt-0.6.3-10.el5
libvirt-debuginfo-0.6.3-10.el5
libvirt-python-0.6.3-10.el5
Comment 9 Daniel Berrange 2009-06-18 06:09:46 EDT
Please stop putting this bug back to ASSIGNED. 

Getting the error message:

libvir: Linux Stats error : internal error read_bd_stats: Frontend block device not connected

is the *CORRECT* expected behaviour for HVM guests where there are no PV drivers installed. 

This bug report is about a completely different problem, namely the error message given back, when the user requests a device name that does not exist for the guest. eg if the guest has /dev/xvda and the user asks for /dev/xvdz instead.

Previously such a scenario would give back

"libvir: Xen error : this function is not supported by the hypervisor:"

now it gives the correct error message:

# virsh domblkstat rhel5pv /dev/xvdz
error: Failed to get block stats rhel5pv /dev/xvdz
error: internal error read_bd_stats: Failed to read any block statistics
Comment 11 errata-xmlrpc 2009-09-02 05:23:00 EDT
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHEA-2009-1269.html

Note You need to log in before you can comment on or make changes to this bug.