[libvirt] [PATCH 1/2] virsh: Switch from generated cmd*Edit commands to nongenerated
Eric Blake
eblake at redhat.com
Fri May 18 17:41:38 UTC 2012
On 05/18/2012 06:48 AM, Michal Privoznik wrote:
> Currently, we either generate some cmd*Edit commands (cmdPoolEdit
> and cmdNetworkEdit) via sed script or copy the body of cmdEdit
> (e.g. cmdInterfaceEdit, cmdNWFilterEdit, etc.). This fact makes
> it harder to implement any new feature to our editing system.
> Therefore switch to new implementation - define macros to:
> - dump XML (EDIT_GET_XML)
> - take an action if XML wasn't changed,
> usually just vshPrint() (EDIT_NOT_CHANGED)
> - define new object (EDIT_DEFINE) - the edited XML is in @doc_edited
> and #include "virsh-edit.c"
> +
> + /* Now re-read the domain XML. Did someone else change it while
> + * it was being edited? This also catches problems such as us
> + * losing a connection or the domain going away.
> + */
> + doc_reread = EDIT_GET_XML;
> + if (!doc_reread)
> + goto edit_cleanup;
Oh, I meant to add - in patch 2/2, this code should be made smarter. If
the session is interactive, then we should give the user a three-way
choice: force their edits (overwriting the changes in the meantime),
reedit by starting from the new definition, or quit. Right now, we are
just quitting without a choice.
--
Eric Blake eblake at 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: 620 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20120518/0d8eb9db/attachment-0001.sig>
More information about the libvir-list
mailing list