[libvirt] [PATCH] virsh: Allow users to reedit rejected XML
Eric Blake
eblake at redhat.com
Wed May 9 14:44:47 UTC 2012
On 05/09/2012 07:52 AM, Daniel P. Berrange wrote:
> On Wed, May 09, 2012 at 03:36:26PM +0200, Michal Privoznik wrote:
>> If users {net-,pool-,}edit but make a mistake in XML all changes
>> are permanently lost. However, if virsh is running in interactive
>> mode we can as user if he wants to re-edit the file and correct
>> the mistakes.
>> ---
>
>> + dom_edited = virDomainDefineXML(ctl->conn, doc_edited);
>> + if (!dom_edited) {
>> + /* Redefine failed. If we are in interactive mode ask user
>> + * if he wants to re-edit the XML. */
>> + if (!ctl->imode ||
>> + vshMakeStdinRaw(&ttyattr, false) < 0)
>> + goto cleanup;
>
> I don't see why this has to be restricted to interactive mode
> only. I almost always just run
>
> virsh edit foo
>
> and there's no reason why we can't prompt to re-edit here too.
>
> What you want to check is isatty(STDIN) so you can distinguish
> batch scripting.
And given that I don't want to bump to a new gnulib version until after
0.9.12, that means we probably should delay an isatty() solution until
after this patch is in:
https://www.redhat.com/archives/libvir-list/2012-May/msg00402.html
--
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/20120509/4bb09060/attachment-0001.sig>
More information about the libvir-list
mailing list