Bug 477275 - virsh domblkstat gives wrong error message when the target device doesn't exist in the guest
Summary: virsh domblkstat gives wrong error message when the target device doesn't exi...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: libvirt
Version: 5.4
Hardware: All
OS: Linux
low
low
Target Milestone: rc
: ---
Assignee: Daniel Veillard
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On: 475821
Blocks:
TreeView+ depends on / blocked
 
Reported: 2008-12-19 23:36 UTC by Gurhan Ozen
Modified: 2023-09-14 01:14 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2009-09-02 09:23:00 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHEA-2009:1269 0 normal SHIPPED_LIVE libvirt bug fix and enhancement update 2009-09-01 09:31:21 UTC

Description Gurhan Ozen 2008-12-19 23:36:22 UTC
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-16 01:11:41 UTC
Seems to be addressed by this commit:

http://git.et.redhat.com/?p=libvirt.git;a=commit;h=d752194d0735c50acf75e75f40cc259fdc0ffd6c

Comment 2 Daniel Berrangé 2009-03-30 11:07:57 UTC
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 07:00:57 UTC
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-23 01:39:44 UTC
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 Berrangé 2009-06-12 11:16:58 UTC
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 Berrangé 2009-06-17 21:41:29 UTC
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-18 01:50:51 UTC
[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 Berrangé 2009-06-18 10:09:46 UTC
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 09:23:00 UTC
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

Comment 12 Red Hat Bugzilla 2023-09-14 01:14:56 UTC
The needinfo request[s] on this closed bug have been removed as they have been unresolved for 1000 days


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