RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1155484 - virDomainBlockCopy cannot get a right flag when use libvirt_virDomainBlockCopy
Summary: virDomainBlockCopy cannot get a right flag when use libvirt_virDomainBlockCopy
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libvirt-python
Version: 7.1
Hardware: x86_64
OS: Linux
high
high
Target Milestone: rc
: ---
Assignee: Pavel Hrdina
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks: 1058757 1199682 1200718 1209839
TreeView+ depends on / blocked
 
Reported: 2014-10-22 08:40 UTC by Luyao Huang
Modified: 2015-04-08 10:15 UTC (History)
5 users (show)

Fixed In Version: libvirt-python-1.2.8-5.el7
Doc Type: Bug Fix
Doc Text:
Clone Of:
: 1199682 (view as bug list)
Environment:
Last Closed: 2015-03-05 07:57:18 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2015:0334 0 normal SHIPPED_LIVE new packages: libvirt-python 2015-03-05 12:23:16 UTC

Description Luyao Huang 2014-10-22 08:40:39 UTC
Description of problem:
virDomainBlockCopy cannot get a right flag when use libvirt_virDomainBlockCopy
(although cannot use virDomainBlockCopy in 1.2.8,but we can use upstream libvirt-1.2.9 to reproduce this issue or use gdb to reproduce this issue with libvirt-1.2.8-5.el7)

Version-Release number of selected component (if applicable):
libvirt-1.2.8-5.el7
libvirt-python-1.2.8-4.el7.x86_64

How reproducible:
100%

Steps to Reproduce:
1.# cat blockcopy.py 

import libvirt
import sys

con = libvirt.open()
domain = con.lookupByName(sys.argv[1])
print   domain.blockCopy("hda","<disk type='file' device='disk'><driver name='qemu' type='raw' cache='none'/><source file='/tmp/test3.img'/></disk>",flags=0)

2.# gdb python
(gdb) br virDomainBlockCopy
Function "virDomainBlockCopy" not defined.
Make breakpoint pending on future shared library load? (y or [n]) y

Breakpoint 1 (virDomainBlockCopy) pending.
(gdb) r blockcopy.py test3

Breakpoint 1, virDomainBlockCopy (dom=dom@entry=0x7559b0, 
    disk=0x7ffff7eda2fc "hda", 
    destxml=0x7ffff7f8fb04 "<disk type='file' device='disk'><driver name='qemu' type='raw' cache='none'/><source file='/tmp/test3.img'/></disk>", params=0x0, 
    nparams=0, flags=32767) at libvirt.c:20069
(gdb) p flags
$1 = 32767

3.

Actual results:
Although we give flags=0
but flags always be 32767(or another value) this will make this function cannot work well with libvirt-1.2.9 and we will get error like:

unsupported flags (0x7f6c) in function qemuDomainBlockCopy

Expected results:
(gdb) p flags
$1 = 0

Additional info:


When use blockCopy, flags cannot get a right value, because
PyArg_ParseTuple want to get 6 parameters and blockCopy only
pass 5.So flags cannot get a right value:

in /usr/lib64/python2.7/site-packages/libvirt.py +637

 637     def blockCopy(self, disk, destxml, params=None, flags=0):
 638         """Copy the guest-visible contents of a disk image to a new file described by destxml """
 639         ret = libvirtmod.virDomainBlockCopy(self._o, disk, destxml, params, flags)
 640         if ret == -1: raise libvirtError ('virDomainBlockCopy() failed', dom=self)
 641         return ret
 642 


in /usr/src/debug/libvirt-python-1.2.8/libvirt-override.c +8111

8111     if (!PyArg_ParseTuple(args, (char *) "Ozz|Oi:virDomainBlockCopy",
8112                           &pyobj_dom, &disk, &destxml, &pyobj_dict, &params     ,
8113                           &flags))
8114         return VIR_PY_INT_FAIL;


Flags will get a unpredictable value, this will make
this function cannot be used.And error just like:

unsupported flags (0x7f6c) in function qemuDomainBlockCopy

I have send my patch to upstream:

https://www.redhat.com/archives/libvir-list/2014-October/msg00575.html

Comment 1 Pavel Hrdina 2014-10-22 09:41:44 UTC
Upstream commit:

commit a7303a56b5e55c29cb5336c84a89b8347a355770
Author: Pavel Hrdina <phrdina>
Date:   Wed Oct 22 11:10:54 2014 +0200

    flags cannot get right value for blockCopy function
    
    When use blockCopy, flags cannot get a right value, because
    PyArg_ParseTuple want to get 6 parameters and blockCopy only
    pass 5. Flags will get a unpredictable value, this will make
    the function fail with error:
    
    unsupported flags (0x7f6c) in function qemuDomainBlockCopy
    
    Signed-off-by: Luyao Huang <lhuang>

Comment 4 Hu Jianwei 2014-11-13 15:39:33 UTC
I can not reproduce it using below versions.

[root@ibm-x3850x5-06 ~]# rpm -q libvirt libvirt-python
libvirt-1.2.8-6.el7.x86_64
libvirt-python-1.2.8-5.el7.x86_64

[root@ibm-x3850x5-06 ~]# cat blockcopy.py 
import libvirt
import sys

con = libvirt.open()
domain = con.lookupByName(sys.argv[1])
print   domain.blockCopy("hda","<disk type='file' device='disk'><driver name='qemu' type='raw' cache='none'/><source file='/tmp/test3.img'/></disk>",flags=0)
[root@ibm-x3850x5-06 ~]# gdb python
...
Reading symbols from /usr/bin/python2.7...Reading symbols from /usr/lib/debug/usr/bin/python2.7.debug...done.
done.
(gdb) b virDomainBlockCopy
Function "virDomainBlockCopy" not defined.
Make breakpoint pending on future shared library load? (y or [n]) y
Breakpoint 1 (virDomainBlockCopy) pending.
(gdb) r blockcopy.py r7
...
Breakpoint 1, virDomainBlockCopy (dom=dom@entry=0x701a90, disk=0x7ffff7ee32fc "hda", 
    destxml=0x7ffff7f99b04 "<disk type='file' device='disk'><driver name='qemu' type='raw' cache='none'/><source file='/tmp/test3.img'/></disk>", params=0x0, nparams=0, flags=0) at libvirt.c:20069
(gdb) p flags
$1 = 0
(gdb) quit

So we can get expected results, change to Verified.

Comment 6 errata-xmlrpc 2015-03-05 07:57:18 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHBA-2015-0334.html


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