netcf need return a detail message when change-begin/change-commit/change-rollback
failed.
I think netcf had better print the returned messages from netcf-transaction.sh into
netcf's error directly.
for example:
[root@rhel6 ~]# virsh iface-begin
error: Failed to begin network config change transaction
error: Requested operation is not valid: failed to begin transaction: Operation invalid in
this state -
Running '/usr/libexec/netcf-transaction.sh change-begin' operation is invalid in
this state:
There is already an open transaction (/var/lib/netcf/network-snapshot exists)
---
src/dutil_posix.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/dutil_posix.c b/src/dutil_posix.c
index 8135cc2..f62aa7d 100644
--- a/src/dutil_posix.c
+++ b/src/dutil_posix.c
@@ -246,8 +246,8 @@ int run_program(struct netcf *ncf, const char *const *argv, char
**output)
"Running '%s' failed to dup2 child process
stdout/stderr",
argv_str);
ERR_THROW(WEXITSTATUS(exitstatus) == EXIT_INVALID_IN_THIS_STATE, ncf, EINVALIDOP,
- "Running '%s' operation is invalid in this state",
- argv_str);
+ "Running '%s' operation is invalid in this state: $s",
+ argv_str, *output);
ERR_THROW(WEXITSTATUS(exitstatus) != 0, ncf, EEXEC,
"Running '%s' failed with exit code %d: %s",
argv_str, WEXITSTATUS(exitstatus), *output);
--
1.8.1.4
Show replies by date
This is a wrong patch, please ignore this mail, sorry for this.
----- Original Message -----
From: "Jianwei Hu" <jiahu(a)redhat.com>
To: netcf-devel(a)lists.fedorahosted.org
Cc: "Jianwei Hu" <jiahu(a)redhat.com>
Sent: Monday, June 23, 2014 10:02:14 AM
Subject: [PATCH] netcf return a clear error message from netcf-transaction.sh
netcf need return a detail message when change-begin/change-commit/change-rollback
failed.
I think netcf had better print the returned messages from netcf-transaction.sh into
netcf's error directly.
for example:
[root@rhel6 ~]# virsh iface-begin
error: Failed to begin network config change transaction
error: Requested operation is not valid: failed to begin transaction: Operation invalid in
this state -
Running '/usr/libexec/netcf-transaction.sh change-begin' operation is invalid in
this state:
There is already an open transaction (/var/lib/netcf/network-snapshot exists)
---
src/dutil_posix.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/dutil_posix.c b/src/dutil_posix.c
index 8135cc2..f62aa7d 100644
--- a/src/dutil_posix.c
+++ b/src/dutil_posix.c
@@ -246,8 +246,8 @@ int run_program(struct netcf *ncf, const char *const *argv, char
**output)
"Running '%s' failed to dup2 child process
stdout/stderr",
argv_str);
ERR_THROW(WEXITSTATUS(exitstatus) == EXIT_INVALID_IN_THIS_STATE, ncf, EINVALIDOP,
- "Running '%s' operation is invalid in this state",
- argv_str);
+ "Running '%s' operation is invalid in this state: $s",
+ argv_str, *output);
ERR_THROW(WEXITSTATUS(exitstatus) != 0, ncf, EEXEC,
"Running '%s' failed with exit code %d: %s",
argv_str, WEXITSTATUS(exitstatus), *output);
--
1.8.1.4