Bug 1152427 - Too small xml size limit for virsh restore command
Summary: Too small xml size limit for virsh restore command
Keywords:
Status: CLOSED NEXTRELEASE
Alias: None
Product: Virtualization Tools
Classification: Community
Component: libvirt
Version: unspecified
Hardware: x86_64
OS: All
unspecified
medium
Target Milestone: ---
Assignee: Peter Krempa
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-10-14 07:12 UTC by Reno
Modified: 2014-10-14 08:29 UTC (History)
2 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2014-10-14 08:29:52 UTC
Embargoed:


Attachments (Terms of Use)

Description Reno 2014-10-14 07:12:15 UTC
Description of problem:
When use "virsh restore vm.img --xml vm.xml" to restore vm, if vm.xml size is over 8192, command will fail with error "Value too large for defined data type"

Version-Release number of selected component (if applicable):
all versions

How reproducible:
restore a vm with "virsh  restore vm.img --xml vm.xml", while vm.xml size is over 8192. 

Actual results:
command will fail with error "Value too large for defined data type"

Expected results:
command succeeds

Additional info:
in tools/virsh-domain.c:4768,virFileReadAll(xmlfile, 8192, &xml) < 0,the second parameter is too small, shall use "VSH_MAX_XML_FILE" constant instead.

Comment 1 Peter Krempa 2014-10-14 08:12:11 UTC
I've proposed a fix upstream:

http://www.redhat.com/archives/libvir-list/2014-October/msg00427.html

Comment 2 Peter Krempa 2014-10-14 08:29:52 UTC
Fixed upstream:

commit 4d1852c48541a29e3c47caf0f2b801dfcb6579db
Author: Peter Krempa <pkrempa>
Date:   Tue Oct 14 10:04:31 2014 +0200

    virsh: domain: Use global constant for XML file size limit
    
    Few places still used hardcoded limit for maximum XML size for commands
    that accept XML files. The hardcoded limits ranged from 8k to 1M. Use
    VSH_MAX_XML_FILE to express this limit in a unified way. This will bump
    the limit for the commands that used hardcoded string lengths to 10M.

The patch will be part of the next release.


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