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
Yes we should fix this, too late for 5.1, but definitely for 5.2, Daniel
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.
This has been fixed upstream and was part of the two lat release: Thu Aug 30 15:11:44 CEST 2007 Daniel Veillard <veillard> * 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
libvirt-0.3.3-1.el5 has been built in dist-5E-qu-candidate with the fix Daniel
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