[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] [PATCH 1/2] virsh: Switch from generated cmd*Edit commands to nongenerated

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 redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]