On Thu, Feb 19, 2015 at 05:24:22PM +0100, Martin Kletzander wrote:
When editing a domain with 'virsh edit' and failing
validation, the
usual message pops up:
Failed. Try again? [y,n,f,?]:
Turning of validation can be ussable, mainly for testing (but other
purposes too), so this patch adds support for relaxing definition in
virsh-edit and makes 'virsh edit <domain>' more usable.
Signed-off-by: Martin Kletzander <mkletzan(a)redhat.com>
---
v2:
- make a special case 'v' for turning off validation
tools/virsh-domain.c | 6 ++++++
tools/virsh-edit.c | 21 +++++++++++++++++++--
tools/virsh.c | 28 +++++++++++++++++++++-------
tools/virsh.h | 4 ++--
4 files changed, 48 insertions(+), 11 deletions(-)
diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index 2506b89..b4761c6 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -11265,7 +11265,13 @@ cmdEdit(vshControl *ctl, const vshCmd *cmd)
} while (0)
#define EDIT_DEFINE \
(dom_edited = vshDomainDefine(ctl->conn, doc_edited, define_flags))
+#define EDIT_RELAX \
+ do { \
+ define_flags &= ~VIR_DOMAIN_DEFINE_VALIDATE; \
+ } while (0);
+
#include "virsh-edit.c"
+#undefine EDIT_RELAX
I did s/undefine/undef/ here, but forgot to squash it in before
sending, but my local commit is fixed, don't worry.