[libvirt] [PATCH] virsh: add --start option to the define command

Eric Blake eblake at redhat.com
Wed Jan 9 16:49:31 UTC 2013


On 01/09/2013 03:28 AM, Daniel P. Berrange wrote:

>> We have virDomainDefineXML with no flags, but we have virDomainCreateXML
>> with flags; maybe the better approach is to add a new creation flag that
>> says that in addition to starting the domain, we also make it persistent
>> at the same time.
>>
>> But if we do that, it would argue that 'virsh create --persistent
>> blah.xml' is nicer than 'virsh define --start blah.xml', at least in
>> that the former needs only 1 API call for new libvirt (but falls back to
>> 2 API calls when talking to older libvirt), while the latter always
>> needs 2 API calls.
>>
>> Or maybe it means we need to add virDomainDefineXMLFlags().
>>
>> Anyone else want to throw some paint on the bikeshed on how best to make
>> the user experience nicer?
> 
> While I think the virsh idea is fine, I don't want to see this done
> at the virDomainDefine API level, since it just duplicates functionality
> already present. Just have virsh make an API call to the existing create
> API.

I agree that we don't really need to add virDomainDefineXMLFlags().  But
I'm not quite clear on your stance on adding a new flag to the existing
virDomainCreateXML().  A single API call is always nicer than two API
calls for atomicity reasons.  That is, I'm proposing that we add a new
flag, and that:

virDomainCreateXML(conn, xml, VIR_DOMAIN_CREATE_PERSISTENT)

be used to both start and define a domain in one call, and only if that
flag is unrecognized do we fall back to the two-API sequence of

virDomainCreateXML(conn, xml, 0) && virDomainDefineXML(conn, xml)

or the equivalent two-API sequence of

dom=virDomainDefineXML(conn, xml) && virDomainCreate(dom)

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 619 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20130109/a8824cc0/attachment-0001.sig>


More information about the libvir-list mailing list