[netcf-devel] [PATCH] netcf return a clear error message from netcf-transaction.sh

Jianwei Hu jiahu at redhat.com
Mon Jun 23 03:05:15 UTC 2014


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 at 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..113e7b4 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



More information about the netcf-devel mailing list