[netcf-devel] [PATCH] netcf return a clear error message from netcf-transaction.sh
Eric Blake
eblake at redhat.com
Mon Jul 28 16:28:48 UTC 2014
On 06/22/2014 09:05 PM, Jianwei Hu wrote:
> 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(-)
ACK from my point of view, but I'll let Laine chime in (he may have been
offline when this first came to the list)
>
> 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);
>
--
Eric Blake eblake 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: 539 bytes
Desc: OpenPGP digital signature
URL: <https://lists.fedorahosted.org/pipermail/netcf-devel/attachments/20140728/974dc711/attachment.sig>
More information about the netcf-devel
mailing list