Skip to content

Commit

Permalink
control/cli.py: read server-address/port defaults from env
Browse files Browse the repository at this point in the history
"--server-address" defaults to env variable
CEPH_NVMEOF_SERVER_ADDRESS (otherwise "localhost").

"--server-port" defaults to env variable
CEPH_NVMEOF_SERVER_PORT (otherwise 5500).

This is to avoid repetitive inputs. If these
environment variables are set, we can just do:
`ceph-nvmeof gw info`.
(instead of current `ceph-nvmeof --server-address /
$NVMEOF_SERVER_ADDRESS --server-port /
$NVMEOF_SERVER_PORT gw info`)

Signed-off-by: Vallari Agrawal <[email protected]>
  • Loading branch information
VallariAg committed Jul 17, 2024
1 parent 10b3004 commit 6f36404
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,16 @@ The same configuration can also be manually run:
cephnvmf host add --subsystem nqn.2016-06.io.spdk:cnode1 --host "*"
```
These can also be run by setting environment variables `CEPH_NVMEOF_SERVER_ADDRESS` and `CEPH_NVMEOF_SERVER_PORT` before running nvmeof-cli commands, example:
```
export CEPH_NVMEOF_SERVER_ADDRESS=x.x.x.x
export CEPH_NVMEOF_SERVER_PORT=5500
// using containers
docker-compose run --it <container_image> subsystem add --subsystem nqn.2016-06.io.spdk:cnode1
// using pypi package
ceph-nvmeof subsystem add --subsystem nqn.2016-06.io.spdk:cnode1
```
### Mounting the NVMe-oF volume
Expand Down
4 changes: 2 additions & 2 deletions control/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,13 +108,13 @@ def __init__(self):
required=False)
self.parser.add_argument(
"--server-address",
default="localhost",
default=(os.getenv('CEPH_NVMEOF_SERVER_ADDRESS') or "localhost"),
type=str,
help="Server address",
)
self.parser.add_argument(
"--server-port",
default=5500,
default=int(os.getenv('CEPH_NVMEOF_SERVER_PORT') or "5500"),
type=int,
help="Server port",
)
Expand Down

0 comments on commit 6f36404

Please sign in to comment.