Bug 273421 - [5.2] virt-install hangs up when 32 NICs or more are specified as --network option
[5.2] virt-install hangs up when 32 NICs or more are specified as --network o...
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: libvirt (Show other bugs)
5.1
All Linux
high Severity high
: ---
: ---
Assigned To: Daniel Veillard
Virtualization Bugs
: Patch
Depends On:
Blocks: 246258
  Show dependency treegraph
 
Reported: 2007-08-31 19:41 EDT by Flavio Leitner
Modified: 2010-10-22 14:19 EDT (History)
3 users (show)

See Also:
Fixed In Version: RHBA-2008-0291
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2008-05-21 12:47:36 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Flavio Leitner 2007-08-31 19:41:59 EDT
Description of problem:

The virt-install command hungs up in a endless busy loop when specified 32 NICs
parameters or more as --network option.

Relevant code parts:
src/xml.c
 407 virBufferVSprintf(virBufferPtr buf, const char *format, ...)
 408 {
...
 415     size = buf->size - buf->use - 1;
...
 418     while (((count = vsnprintf(&buf->content[buf->use], size, format,
 419                                locarg)) < 0) || (count >= size - 1)) {
...
 424         if (virBufferGrow(buf, 1000) < 0) {
 425             return (-1);
 426         }
 427         size = buf->size - buf->use - 1;
...
 429     }


 281 virBufferGrow(virBufferPtr buf, unsigned int len)
 282 {
...
 291     size = buf->use + len + 1000;
...
 293     newbuf = (char *) realloc(buf->content, size);
...
 299     buf->size = size;
...
 301 }

When a number of parameter NICs is bigger enough to vsnprintf have to truncate,
it will return the number of bytes which would have been written to the final
string. In line 291 it does:

size = buf->use + 1000 + 1000.

It is _constant_ regardless of count, then the condition on line 491 
(count >= size - 1) is always true entering on busy loop.

Example: initial buffer size = 1000 and vsnprintf() returns 2600, the line 491
is true and calls virBufferGrow(,1000), then the size now is:
size = few used bytes(300) + 1000 + 1000 = 2300, so It runs the loop again and
the count still is 2600, calls virBufferGrow(1000) which ends up on the same
size as in previous loop entering in busy loop.


Version-Release number of selected component (if applicable):
libvirt-0.2.3-9.el5

How reproducible:
Always

Steps to Reproduce:
1. Run:
# virt-install --name=test --ram=350 --file=/dev/sda5 --paravirt \
   --location=ftp://10.131.236.20/rhel5.1b_ia64< /a> --vnc --network=bridge \
   --network=bridge --network=bridge --network=bridge --network=bridge \
   --network=bridge --network=bridge --network=bridge --network=bridge \
   --network=bridge --network=bridge --network=bridge --network=bridge \
   --network=bridge --network=bridge --network=bridge --network=bridge \
   --network=bridge --network=bridge --network=bridge --network=bridge \
   --network=bridge --network=bridge --network=bridge --network=bridge \
   --network=bridge --network=bridge --network=bridge --network=bridge \
   --network=bridge --network=bridge --network=bridge

  
Actual results:
virt-install enter on endless busy loop

Expected results:
virt-install configure and install a vm with 32 or NICs.

Additional info:
Patch to fix this issue is available at:
https://www.redhat.com/archives/libvir-list/2007-August/msg00213.html
Comment 1 Daniel Veillard 2007-09-24 06:24:50 EDT
Yes we should fix this, too late for 5.1, but definitely for 5.2,

Daniel
Comment 2 RHEL Product and Program Management 2007-10-15 23:42:54 EDT
This request was evaluated by Red Hat Product Management for inclusion in a Red
Hat Enterprise Linux maintenance release.  Product Management has requested
further review of this request by Red Hat Engineering, for potential
inclusion in a Red Hat Enterprise Linux Update release for currently deployed
products.  This request is not yet committed for inclusion in an Update
release.
Comment 3 Daniel Veillard 2007-10-16 05:04:40 EDT
This has been fixed upstream and was part of the two lat release:

Thu Aug 30 15:11:44 CEST 2007 Daniel Veillard <veillard@redhat.com>

        * src/buf.c: applied patch from Masayuki Sunou fixing a loop
          due to an error in growing buffers.

This definitely should get devel_ack+,

Daniel
Comment 5 Daniel Veillard 2007-12-11 10:10:58 EST
libvirt-0.3.3-1.el5 has been built in dist-5E-qu-candidate with the fix
 
Daniel
Comment 9 errata-xmlrpc 2008-05-21 12:47:36 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 the 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/RHBA-2008-0291.html

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