Bug 1370424 - virt-manager coredump when vm with gluster image exists
Summary: virt-manager coredump when vm with gluster image exists
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libguestfs
Version: 7.3
Hardware: x86_64
OS: Unspecified
medium
medium
Target Milestone: rc
: ---
Assignee: Richard W.M. Jones
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-08-26 09:53 UTC by Xiaodai Wang
Modified: 2016-11-03 18:03 UTC (History)
9 users (show)

Fixed In Version: libguestfs-1.32.7-3.el7
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-11-03 18:03:50 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
gdb log (20.04 KB, text/plain)
2016-08-26 09:54 UTC, Xiaodai Wang
no flags Details
guest xml (5.20 KB, text/plain)
2016-08-26 09:54 UTC, Xiaodai Wang
no flags Details
virt-manager debug log (19.01 KB, text/plain)
2016-08-26 09:54 UTC, Xiaodai Wang
no flags Details
rhel6.7_spice xml (4.25 KB, text/plain)
2016-08-26 11:09 UTC, Xiaodai Wang
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2016:2576 0 normal SHIPPED_LIVE Moderate: libguestfs and virt-p2v security, bug fix, and enhancement update 2016-11-03 12:06:51 UTC

Description Xiaodai Wang 2016-08-26 09:53:30 UTC
Description of problem:
virt-manager coredump when vm with gluster image exists

Version-Release number of selected component (if applicable):
virt-manager-1.4.0-1.el7.noarch
python-libguestfs-1.32.7-2.el7.x86_64
libvirt-2.0.0-6.el7.x86_64

# uname -r
3.10.0-493.el7.x86_64

How reproducible:
100%

Steps to Reproduce:
1. Make sure python-libguestfs is installed.
2. Run virt-install to create a guest which has gluster image. 
# virt-install --name gluster1 --memory 1024 --disk gluster://10.66.4.164/gluster-vol1/xdw.qcow2 -l http://download.englab.nay.redhat.com/pub/rhel/released/RHEL-6/6.6/Server/x86_64/os
3. Open virt-manager and wait a moment.

Actual results:
virt-manager crash after several seconds.

Expected results:
virt-manager should not crash.

Additional info:
1. Please see attachment for virt-manager/gdb/guest_xml log.
2. This issue doesn't occur after removing python-libguestfs-1.32.7-2.el7.x86_64

Comment 1 Xiaodai Wang 2016-08-26 09:54:00 UTC
Created attachment 1194275 [details]
gdb log

Comment 2 Xiaodai Wang 2016-08-26 09:54:24 UTC
Created attachment 1194276 [details]
guest xml

Comment 3 Xiaodai Wang 2016-08-26 09:54:48 UTC
Created attachment 1194277 [details]
virt-manager debug log

Comment 4 Richard W.M. Jones 2016-08-26 11:00:32 UTC
The stack trace indicates that this assertion is hit in libguestfs:

https://github.com/libguestfs/libguestfs/blob/master/src/libvirt-domain.c#L613

Comment 5 Richard W.M. Jones 2016-08-26 11:02:08 UTC
xiaodwan, could you do me a favour and dump the XML of one guest:

  virsh dumpxml rhel6.7_spice

I suspect it has an unexpected port=0 attribute, or something like that.

Comment 6 Xiaodai Wang 2016-08-26 11:09:38 UTC
Created attachment 1194306 [details]
rhel6.7_spice xml

Comment 8 Pino Toscano 2016-08-26 13:50:04 UTC
Most probably the cause is in the 'gluster1' guest:

    <disk type='network' device='disk'>
      <driver name='qemu' type='raw'/>
      <source protocol='gluster' name='gluster-vol1/xdw.qcow2'>
        <host name='10.66.4.164'/>
      </source>
      <backingStore/>
      <target dev='vda' bus='virtio'/>
      <alias name='virtio-disk0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/>
    </disk>

because the <host> tag has no "port" attribute.  I guess we could fallback to some default port depending on the protocol; I will see what libvirt does in this case.

Comment 9 Pino Toscano 2016-08-26 14:53:12 UTC
(In reply to Pino Toscano from comment #8)
> I will see what libvirt does in this case.

http://libvirt.org/git/?p=libvirt.git;a=blob;f=src/qemu/qemu_command.c;hb=HEAD#l436
(reformatted to make it shorter)

  static int qemuNetworkDriveGetPort(int protocol, const char *port)
  {
      int ret = 0;
      if (port) {
          if (virStrToLong_i(port, NULL, 10, &ret) < 0 || ret < 0) {
              virReportError(VIR_ERR_INTERNAL_ERROR, _("failed to parse port number '%s'"), port);
              return -1;
          }
          return ret;
      }
      switch ((virStorageNetProtocol) protocol) {
          case VIR_STORAGE_NET_PROTOCOL_HTTP:
              return 80;
          case VIR_STORAGE_NET_PROTOCOL_HTTPS:
              return 443;
          case VIR_STORAGE_NET_PROTOCOL_FTP:
              return 21;
          case VIR_STORAGE_NET_PROTOCOL_FTPS:
              return 990;
          case VIR_STORAGE_NET_PROTOCOL_TFTP:
              return 69;
          case VIR_STORAGE_NET_PROTOCOL_SHEEPDOG:
              return 7000;
          case VIR_STORAGE_NET_PROTOCOL_NBD:
              return 10809;
          case VIR_STORAGE_NET_PROTOCOL_SSH:
              return 22;
          case VIR_STORAGE_NET_PROTOCOL_ISCSI:
          case VIR_STORAGE_NET_PROTOCOL_GLUSTER:
              /* no default port specified */
              return 0;
          case VIR_STORAGE_NET_PROTOCOL_RBD:
          case VIR_STORAGE_NET_PROTOCOL_LAST:
          case VIR_STORAGE_NET_PROTOCOL_NONE:
              /* not applicable */
              return -1;
      }
      return -1;
  }

So if there is no "port" attribute at all, a default value is used according to the protocol. Most probably we could do something similar, and append the port to the host string only if specified or there's a default value for it.

Comment 10 Richard W.M. Jones 2016-08-27 08:13:24 UTC
Patch posted:
https://www.redhat.com/archives/libguestfs/2016-August/msg00211.html

Comment 11 Richard W.M. Jones 2016-08-30 12:01:51 UTC
Upstream commits:

9e7b564fc1d9fa0e99a46e4739614820812ca42b
98aa78f288e44868bcccf56b777d57d9fd4ec6a6

Comment 13 Xianghua Chen 2016-09-06 08:14:33 UTC
Verified with packages:
python-libguestfs-1.32.7-3.el7.x86_64

Steps:
1. Make sure python-libguestfs is installed.
2. Prepare an gluster env, run virt-install to create a guest which has gluster image. 
# virt-install --name gluster1 --memory 1024 --disk gluster://10.66.4.164/gluster-vol1/xdw.qcow2 -l http://download.englab.nay.redhat.com/pub/rhel/released/RHEL-6/6.6/Server/x86_64/os
Don't need to install it, just ensure the guest is started.
3. Open virt-manager and wait a moment.

Virt-manager doesn't crash and exit after few minutes.

So verified.

Comment 15 errata-xmlrpc 2016-11-03 18:03:50 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/RHSA-2016-2576.html


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