[virt-tools-list] [RFC] virt-disk : a command line tool for modify domain XML's disk of inactive domains.

Cole Robinson crobinso at redhat.com
Tue Feb 22 12:36:18 UTC 2011


On 02/21/2011 06:48 PM, KAMEZAWA Hiroyuki wrote:
> On Mon, 21 Feb 2011 10:08:46 -0500
> Cole Robinson <crobinso at redhat.com> wrote:
> 
>> On 02/21/2011 03:23 AM, KAMEZAWA Hiroyuki wrote:
>>> Hi, now, with qemu, virsh attach-disk doesn't work with inactive disks and
>>> we need to edit XML with virsh edit.
>>> IIUC, libvirt and virsh is designed as it is.
>>>
>>> But I want to modify domain XML via commandline tools
>>>  - for middleware, which modify domains by scripting.
>>>  - for concsoles, where curses can't work correctly.
>>>  - for me, I can't remember XML definition detaisl ;)
>>>  
>>> So, I write one.
>>>
>>> Following script is a script for modify domain XML and allows
>>>   - add disks
>>>   - delete disks
>>>   - show list of disks
>>>
>>> I think most of elements defined in http://libvirt.org/formatdomain.html#elementsDisks
>>> is supported. But I'm an only qemu user and didn't test with Xen and other VMs.
>>>
>>> What I wanted to hear opinions as 'RFC' is
>>>  - Can this be shipped with libvirt as one of a tool ? (with more documents)
>>>    (If so, we'll write other scripts for cpu,network,memory,etc...)
>>>
>>>  - If not, what is the best way other than making this as my house script ?
>>>    I'm grad if this is shipped with libvirt is because catching new definition
>>>    of XML is easy.
>>>
>>>  - Doesn't this one work with your environment ?
>>>
>>>  
>>
>> Thanks for taking a stab at this, I've been meaning to start a similar tool
>> for some time. However, you should be able to leverage virtinst to accomplish
>> nearly all the XML parsing, and reuse existing virt-install command line
>> options and documentation. Additionally the tool could build or edit any
>> arbitrary domain XML and wouldn't be specific to disks.
>>
> 
> Thank you, that's the information I wanted to hear ...where this kind of command
> should be packaged into. I'll look virt-inst package. And, as I wrote, this is 
> just an example, we'll support all cpu,memory,interface,usb etc....
> 
> Do you think should all be supported by 'a' command ? or by a set of commands ?
> 
> [at modify cpu]
> % virt-modify --cpu .....
> or
> % virt-cpu-modify   .....
> 

I would say just a single command. I imagined it would be called virt-xml and
would be able to do the following:

- Lookup an existing libvirt object and edit inactive XML in place
- Lookup an existing libvirt object and perform hotplug operations
- Take an XML document from a file or stdin and edit XML
- Generate domain device XML, possibly also pool, vol, network, interface,
etc. XML

Maybe we should have separate tools for domain vs. storage vs. network etc,
but I think the first iteration of the tool will be domain specific anyways so
we can defer the question for a bit.

Thanks,
Cole

> 
>> Take a look at tests/xmlparse.py in the virtinst repo to see how the parsing
>> works and what it's capable of.
>>
> 
> Thanks. We'll look into.
> 
> Regards,
> -Kame
> 




More information about the virt-tools-list mailing list