From: ogawa.yasufumi@lab.ntt.co.jp
To: spp@dpdk.org, ferruh.yigit@intel.com, ogawa.yasufumi@lab.ntt.co.jp
Subject: [spp] [PATCH v2 3/5] controller: change pri exit cmd to call REST API
Date: Fri, 9 Nov 2018 12:21:36 +0900 [thread overview]
Message-ID: <20181109032138.90520-4-ogawa.yasufumi@lab.ntt.co.jp> (raw)
In-Reply-To: <20181109032138.90520-1-ogawa.yasufumi@lab.ntt.co.jp>
From: Yasufumi Ogawa <ogawa.yasufumi@lab.ntt.co.jp>
To send `exit` command to spp_primary, change to call REST API of
spp-ctl.
This patch includes update for removing `exit` from `pri` command
to avoid terminating spp_primary while running secondary processes.
Use `bye all` command for graceful terminating.
Signed-off-by: Yasufumi Ogawa <ogawa.yasufumi@lab.ntt.co.jp>
---
src/controller/commands/bye.py | 2 +-
src/controller/commands/pri.py | 16 ++++++++++++----
2 files changed, 13 insertions(+), 5 deletions(-)
diff --git a/src/controller/commands/bye.py b/src/controller/commands/bye.py
index e5ca3bb..3ffc259 100644
--- a/src/controller/commands/bye.py
+++ b/src/controller/commands/bye.py
@@ -28,7 +28,7 @@ class SppBye(object):
print('Closing secondary ...')
self.close_all_secondary(sec_ids)
print('Closing primary ...')
- self.spp_primary.run('exit')
+ self.spp_primary.do_exit()
def complete(self, text, line, begidx, endidx):
diff --git a/src/controller/commands/pri.py b/src/controller/commands/pri.py
index b51138d..51da7ab 100644
--- a/src/controller/commands/pri.py
+++ b/src/controller/commands/pri.py
@@ -13,7 +13,7 @@ class SppPrimary(object):
"""
# All of primary commands used for validation and completion.
- PRI_CMDS = ['status', 'exit', 'clear']
+ PRI_CMDS = ['status', 'clear']
def __init__(self, spp_ctl_cli):
self.spp_ctl_cli = spp_ctl_cli
@@ -46,12 +46,20 @@ class SppPrimary(object):
else:
print('Error: unknown response.')
- elif cmd == 'exit':
- print('"pri; exit" is deprecated.')
-
else:
print('Invalid pri command!')
+ def do_exit(self):
+ res = self.spp_ctl_cli.delete('primary')
+ if res is not None:
+ error_codes = self.spp_ctl_cli.rest_common_error_codes
+ if res.status_code == 204:
+ print('Exit primary')
+ elif res.status_code in error_codes:
+ pass
+ else:
+ print('Error: unknown response.')
+
def print_status(self, json_obj):
"""Parse SPP primary's status and print.
--
2.7.4
next prev parent reply other threads:[~2018-11-09 3:21 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-25 5:20 [spp] [PATCH 0/5] Add exit command support for spp_primary ogawa.yasufumi
2018-10-25 5:20 ` [spp] [PATCH 1/5] primary: chage to return msg of exit command ogawa.yasufumi
2018-10-25 5:20 ` [spp] [PATCH 2/5] spp-ctl: add exit cmd support for spp_primary ogawa.yasufumi
2018-10-25 5:20 ` [spp] [PATCH 3/5] controller: change pri exit cmd to call REST API ogawa.yasufumi
2018-10-25 5:20 ` [spp] [PATCH 4/5] docs: add DELETE method for exiting spp_primary ogawa.yasufumi
2018-10-25 5:20 ` [spp] [PATCH 5/5] docs: remove exit from pri command ogawa.yasufumi
2018-11-09 3:21 ` [spp] [PATCH v2 0/5] Add exit command support for spp_primary ogawa.yasufumi
2018-11-09 3:21 ` [spp] [PATCH v2 1/5] primary: chage to return msg of exit command ogawa.yasufumi
2018-11-09 3:21 ` [spp] [PATCH v2 2/5] spp-ctl: add exit cmd support for spp_primary ogawa.yasufumi
2018-11-09 3:21 ` ogawa.yasufumi [this message]
2018-11-09 3:21 ` [spp] [PATCH v2 4/5] docs: add DELETE method for exiting spp_primary ogawa.yasufumi
2018-11-09 3:21 ` [spp] [PATCH v2 5/5] docs: remove exit from pri command ogawa.yasufumi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20181109032138.90520-4-ogawa.yasufumi@lab.ntt.co.jp \
--to=ogawa.yasufumi@lab.ntt.co.jp \
--cc=ferruh.yigit@intel.com \
--cc=spp@dpdk.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).