diff mbox

[v1,1/7] tools/livepatch: Show the correct expected state before action

Message ID 1481559490-13844-2-git-send-email-ross.lagerwall@citrix.com (mailing list archive)
State New, archived
Headers show

Commit Message

Ross Lagerwall Dec. 12, 2016, 4:18 p.m. UTC
Somewhat confusingly, before the action has been executed the patch is
expected to be in the "allowed" state, not the "expected" state.  The
check for this was correct but the subsequent error message was not.
Fix the error message to show this state correctly.

Before:
    $ xen-livepatch unload test
    test: in wrong state (APPLIED), expected (unknown)
After:
    $ xen-livepatch unload test
    test: in wrong state (APPLIED), expected (CHECKED)

Signed-off-by: Ross Lagerwall <ross.lagerwall@citrix.com>
---
 tools/misc/xen-livepatch.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Wei Liu Dec. 12, 2016, 5:02 p.m. UTC | #1
On Mon, Dec 12, 2016 at 04:18:04PM +0000, Ross Lagerwall wrote:
> Somewhat confusingly, before the action has been executed the patch is
> expected to be in the "allowed" state, not the "expected" state.  The

ITYM "allow", according to your code.

> check for this was correct but the subsequent error message was not.
> Fix the error message to show this state correctly.
> 
> Before:
>     $ xen-livepatch unload test
>     test: in wrong state (APPLIED), expected (unknown)
> After:
>     $ xen-livepatch unload test
>     test: in wrong state (APPLIED), expected (CHECKED)
> 
> Signed-off-by: Ross Lagerwall <ross.lagerwall@citrix.com>

Acked-by: Wei Liu <wei.liu2@citrix.com>

> ---
>  tools/misc/xen-livepatch.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tools/misc/xen-livepatch.c b/tools/misc/xen-livepatch.c
> index 2de04c0..f6c7c8a 100644
> --- a/tools/misc/xen-livepatch.c
> +++ b/tools/misc/xen-livepatch.c
> @@ -308,7 +308,7 @@ int action_func(int argc, char *argv[], unsigned int idx)
>      {
>          printf("%s: in wrong state (%s), expected (%s)\n",
>                 name, state2str(status.state),
> -               state2str(action_options[idx].expected));
> +               state2str(action_options[idx].allow));
>          return -1;
>      }
>  
> -- 
> 2.7.4
>
diff mbox

Patch

diff --git a/tools/misc/xen-livepatch.c b/tools/misc/xen-livepatch.c
index 2de04c0..f6c7c8a 100644
--- a/tools/misc/xen-livepatch.c
+++ b/tools/misc/xen-livepatch.c
@@ -308,7 +308,7 @@  int action_func(int argc, char *argv[], unsigned int idx)
     {
         printf("%s: in wrong state (%s), expected (%s)\n",
                name, state2str(status.state),
-               state2str(action_options[idx].expected));
+               state2str(action_options[idx].allow));
         return -1;
     }