zunclient(1)
| PYTHON-ZUNCLIENT(1) | python-zunclient | PYTHON-ZUNCLIENT(1) |
NAME
python-zunclient - python-zunclient 4.6.0
CONTENTS
Installation Guide
At the command line:
$ pip install python-zunclient
Or, if you have virtualenvwrapper installed:
$ mkvirtualenv python-zunclient $ pip install python-zunclient
Contributor's Guide
If you would like to contribute to the development of OpenStack, you must follow the steps in this page:
If you already have a good understanding of how the system works and your OpenStack accounts are set up, you can skip to the development workflow section of this documentation to learn how changes to OpenStack should be submitted for review via the Gerrit tool:
Pull requests submitted through GitHub will be ignored.
Bugs should be filed on Launchpad, not GitHub:
User Documentation
Zun CLI man page
SYNOPSIS
Zun operation use zun command, and also support use openstack command.
zun [options] <command> [command-options]
openstack appcontainer <command> [command-options]
DESCRIPTION
The zun command line utility interacts with OpenStack Containers Service (Zun).
In order to use the CLI, you must provide your OpenStack username, password, project (historically called tenant), and auth endpoint. You can use configuration options --os-username, --os-password, --os-tenant-name or --os-tenant-id, and --os-auth-url or set corresponding environment variables:
export OS_USERNAME=user export OS_PASSWORD=pass export OS_PROJECT_NAME=myproject export OS_AUTH_URL=http://auth.example.com:5000/v3 export OS_USER_DOMAIN_ID=default export OS_PROJECT_DOMAIN_ID=default
OPTIONS
To get a list of available commands and options run:
zun help
To get usage and options of a command:
zun help <command>
You can also use openstack command as follow.
To get a list of available commands run:
openstack help appcontainer
To get usage and options of a command:
openstack appcontainer <command> --help
EXAMPLES
List all the containers:
zun list
Create new container:
zun run --name container01 IMAGE01
Describe a specific container:
zun show container01
You can also use openstack command as follow.
List all the containers:
openstack appcontainer list
Create new container:
openstack appcontainer run --name container01 IMAGE01
Describe a specific container:
openstack appcontainer show container01
Command List
appcontainer action
An appcontainer action specifies the action details for a container.
appcontainer action list
List actions on a container
openstack appcontainer action list [-h]
[-f {csv,json,table,value,yaml}]
[-c COLUMN] [--max-width <integer>]
[--fit-width] [--print-empty]
[--noindent]
[--quote {all,minimal,none,nonnumeric}]
[--sort-column SORT_COLUMN]
<container>
- <container>
- ID or name of the container to list actions.
- -h, --help
- show this help message and exit
- -f {csv,json,table,value,yaml},
- --format {csv,json,table,value,yaml}
- the output format, defaults to table
- -c COLUMN, --column COLUMN
- specify the column(s) to include, can be repeated
- --sort-column SORT_COLUMN
- specify the column(s) to sort the data (columns specified first have a priority, non-existing columns are ignored), can be repeated
- --max-width <integer>
- Maximum display width, <1 to disable. You can also use the CLIFF_MAX_TERM_WIDTH environment variable, but the parameter takes precedence.
- --fit-width
- Fit the table to the display width. Implied if --max-width greater than 0. Set the environment variable CLIFF_FIT_WIDTH=1 to always enable
- --print-empty
- Print empty table if there is no data to show.
- --noindent
- whether to disable indenting the JSON
- --quote {all,minimal,none,nonnumeric}
- when to include quotes, defaults to nonnumeric
appcontainer action show
Shows action
openstack appcontainer action show [-h]
[-f {json,shell,table,value,yaml}]
[-c COLUMN] [--max-width <integer>]
[--fit-width] [--print-empty]
[--noindent] [--prefix PREFIX]
<container> <request_id>
- <container>
- ID or name of the container to show.
- <request_id>
- request ID of action to describe.
- -f {json,shell,table,value,yaml},
- --format {json,shell,table,value,yaml}
- the output format, defaults to table
- -c COLUMN, --column COLUMN
- specify the column(s) to include, can be repeated
- --max-width <integer>
- Maximum display width, <1 to disable. You can also use the CLIFF_MAX_TERM_WIDTH environment variable, but the parameter takes precedence.
- --fit-width
- Fit the table to the display width. Implied if --max-width greater than 0. Set the environment variable CLIFF_FIT_WIDTH =1 to always enable
- --print-empty
- Print empty table if there is no data to show.
- --noindent
- whether to disable indenting the JSON
- --prefix PREFIX
- add a prefix to all variable names
appcontainer host
An appcontainer host specifies the compute host for running containers.
appcontainer host list
List available hosts
openstack appcontainer host list [-h] [-f {csv,json,table,value,yaml}]
[-c COLUMN] [--max-width <integer>]
[--fit-width] [--print-empty]
[--noindent]
[--quote {all,minimal,none,nonnumeric}]
[--sort-column SORT_COLUMN]
[--marker <marker>] [--limit <limit>]
[--sort-key <sort-key>]
[--sort-dir <sort-dir>]
- -h, --help
- show this help message and exit
- --marker <marker>
- The last host UUID of the previous page; displays list of hosts after "marker".
- --limit <limit>
- Maximum number of hosts to return
- --sort-key <sort-key>
- Column to sort results by
- --sort-dir <sort-dir>
- Direction to sort. "asc" or "desc".
- -f {csv,json,table,value,yaml},
- --format {csv,json,table,value,yaml}
- the output format, defaults to table
- -c COLUMN, --column COLUMN
- specify the column(s) to include, can be repeated
- --sort-column SORT_COLUMN
- specify the column(s) to sort the data (columns specified first have a priority, non-existing columns are ignored), can be repeated
- --max-width <integer>
- Maximum display width, <1 to disable. You can also use the CLIFF_MAX_TERM_WIDTH environment variable, but the parameter takes precedence.
- --fit-width
- Fit the table to the display width. Implied if --max- width greater than 0. Set the environment variable CLIFF_FIT_WIDTH=1 to always enable
- --print-empty
- Print empty table if there is no data to show.
- --noindent
- whether to disable indenting the JSON
- --quote {all,minimal,none,nonnumeric}
- when to include quotes, defaults to nonnumeric
appcontainer host show
Show a host
openstack appcontainer host show [-h]
[-f {json,shell,table,value,yaml}]
[-c COLUMN] [--max-width <integer>]
[--fit-width] [--print-empty]
[--noindent] [--prefix PREFIX]
<host>
- <host>
- ID or name of the host to show.
- -h, --help
- show this help message and exit
- -f {json,shell,table,value,yaml},
- --format {json,shell,table,value,yaml}
- the output format, defaults to table
- -c COLUMN, --column COLUMN
- specify the column(s) to include, can be repeated
- --max-width <integer>
- Maximum display width, <1 to disable. You can also use the CLIFF_MAX_TERM_WIDTH environment variable, but the parameter takes precedence.
- --fit-width
- Fit the table to the display width. Implied if --max- width greater than 0. Set the environment variable CLIFF_FIT_WIDTH=1 to always enable
- --print-empty
- Print empty table if there is no data to show.
- --noindent
- whether to disable indenting the JSON
- --prefix PREFIX
- add a prefix to all variable names
appcontainer image
An appcontainer image specifies the image for a host.
appcontainer image list
List available images
openstack appcontainer image list [-h] [-f {csv,json,table,value,yaml}]
[-c COLUMN] [--max-width <integer>]
[--fit-width] [--print-empty]
[--noindent]
[--quote {all,minimal,none,nonnumeric}]
[--sort-column SORT_COLUMN]
[--marker <marker>] [--limit <limit>]
[--sort-key <sort-key>]
[--sort-dir <sort-dir>]
- -h, --help
- show this help message and exit
- --marker <marker>
- The last host UUID of the previous page; displays list of hosts after "marker".
- --limit <limit>
- Maximum number of hosts to return
- --sort-key <sort-key>
- Column to sort results by
- --sort-dir <sort-dir>
- Direction to sort. "asc" or "desc".
- -f {csv,json,table,value,yaml},
- --format {csv,json,table,value,yaml}
- the output format, defaults to table
- -c COLUMN, --column COLUMN
- specify the column(s) to include, can be repeated
- --sort-column SORT_COLUMN
- specify the column(s) to sort the data (columns specified first have a priority, non-existing columns are ignored), can be repeated
- --max-width <integer>
- Maximum display width, <1 to disable. You can also use the CLIFF_MAX_TERM_WIDTH environment variable, but the parameter takes precedence.
- --fit-width
- Fit the table to the display width. Implied if --max- width greater than 0. Set the environment variable CLIFF_FIT_WIDTH=1 to always enable
- --print-empty
- Print empty table if there is no data to show.
- --noindent
- whether to disable indenting the JSON
- --quote {all,minimal,none,nonnumeric}
- when to include quotes, defaults to nonnumeric
appcontainer image show
Describe a specific image
openstack appcontainer image show [-h]
[-f {json,shell,table,value,yaml}]
[-c COLUMN] [--max-width <integer>]
[--fit-width] [--print-empty]
[--noindent] [--prefix PREFIX]
<uuid>
- <uuid>
- UUID of image to describe
- -h, --help
- show this help message and exit
- -f {json,shell,table,value,yaml},
- --format {json,shell,table,value,yaml}
- the output format, defaults to table
- -c COLUMN, --column COLUMN
- specify the column(s) to include, can be repeated
- --max-width <integer>
- Maximum display width, <1 to disable. You can also use the CLIFF_MAX_TERM_WIDTH environment variable, but the parameter takes precedence.
- --fit-width
- Fit the table to the display width. Implied if --max- width greater than 0. Set the environment variable CLIFF_FIT_WIDTH=1 to always enable
- --print-empty
- Print empty table if there is no data to show.
- --noindent
- whether to disable indenting the JSON
- --prefix PREFIX
- add a prefix to all variable names
appcontainer image delete
Delete specified image from a host
openstack appcontainer image delete [-h] <uuid> <host>
- <uuid>
- UUID of image to describe
- <host>
- Name or UUID of the host
- -h, --help
- show this help message and exit
appcontainer image pull
Pull specified image into a host
openstack appcontainer image pull [-h]
[-f {json,shell,table,value,yaml}]
[-c COLUMN] [--max-width <integer>]
[--fit-width] [--print-empty]
[--noindent] [--prefix PREFIX]
<image> <host>
- <image>
- Name of the image
- <host>
- Name or UUID of the host
- -h, --help
- show this help message and exit
- -f {json,shell,table,value,yaml},
- --format {json,shell,table,value,yaml}
- the output format, defaults to table
- -c COLUMN, --column COLUMN
- specify the column(s) to include, can be repeated
- --max-width <integer>
- Maximum display width, <1 to disable. You can also use the CLIFF_MAX_TERM_WIDTH environment variable, but the parameter takes precedence.
- --fit-width
- Fit the table to the display width. Implied if --max- width greater than 0. Set the environment variable CLIFF_FIT_WIDTH=1 to always enable
- --print-empty
- Print empty table if there is no data to show.
- --noindent
- whether to disable indenting the JSON
- --prefix PREFIX
- add a prefix to all variable names
appcontainer image search
Search the image repository for images
openstack appcontainer image search [-h]
[-f {csv,json,table,value,yaml}]
[-c COLUMN] [--max-width <integer>]
[--fit-width] [--print-empty]
[--noindent]
[--quote {all,minimal,none,nonnumeric}]
[--sort-column SORT_COLUMN]
[--image-driver <image-driver>]
[--exact-match]
<image_name>
- <image_name>
- Name of the image
- -h, --help
- show this help message and exit
- --image-driver <image-driver>
- Name of the image driver
- --exact-match
- exact match image name
- -f {csv,json,table,value,yaml},
- --format {csv,json,table,value,yaml}
- the output format, defaults to table
- -c COLUMN, --column COLUMN
- specify the column(s) to include, can be repeated
- --sort-column SORT_COLUMN
- specify the column(s) to sort the data (columns specified first have a priority, non-existing columns are ignored), can be repeated
- --max-width <integer>
- Maximum display width, <1 to disable. You can also use the CLIFF_MAX_TERM_WIDTH environment variable, but the parameter takes precedence.
- --fit-width
- Fit the table to the display width. Implied if --max- width greater than 0. Set the environment variable CLIFF_FIT_WIDTH=1 to always enable
- --print-empty
- Print empty table if there is no data to show.
- --noindent
- whether to disable indenting the JSON
- --quote {all,minimal,none,nonnumeric}
- when to include quotes, defaults to nonnumeric
appcontainer service
An appcontainer service specifies the zun services.
appcontainer service list
Print a list of zun services
openstack appcontainer service list [-h]
[-f {csv,json,table,value,yaml}]
[-c COLUMN] [--max-width <integer>]
[--fit-width] [--print-empty]
[--noindent]
[--quote {all,minimal,none,nonnumeric}]
[--sort-column SORT_COLUMN]
- -h, --help
- show this help message and exit
- -f {csv,json,table,value,yaml},
- --format {csv,json,table,value,yaml}
- the output format, defaults to table
- -c COLUMN, --column COLUMN
- specify the column(s) to include, can be repeated
- --sort-column SORT_COLUMN
- specify the column(s) to sort the data (columns specified first have a priority, non-existing columns are ignored), can be repeated
- --max-width <integer>
- Maximum display width, <1 to disable. You can also use the CLIFF_MAX_TERM_WIDTH environment variable, but the parameter takes precedence.
- --fit-width
- Fit the table to the display width. Implied if --max- width greater than 0. Set the environment variable CLIFF_FIT_WIDTH=1 to always enable
- --print-empty
- Print empty table if there is no data to show.
- --noindent
- whether to disable indenting the JSON
- --quote {all,minimal,none,nonnumeric}
- when to include quotes, defaults to nonnumeric
appcontainer service delete
Delete the Zun binaries/services.
openstack appcontainer service delete [-h] <host> <binary>
- <host>
- Name of host
- <binary>
- Name of the binary to delete
- -h, --help
- show this help message and exit
appcontainer service forcedown
Force the Zun service to down or up.
openstack appcontainer service forcedown [-h]
[-f {json,shell,table,value,yaml}]
[-c COLUMN]
[--max-width <integer>]
[--fit-width] [--print-empty]
[--noindent] [--prefix PREFIX]
[--unset]
<host> <binary>
- <host>
- Name of host
- <binary>
- Name of the binary to forcedown
- -h, --help
- show this help message and exit
- --unset
- Unset the force state down of service
- -f {json,shell,table,value,yaml},
- --format {json,shell,table,value,yaml}
- the output format, defaults to table
- -c COLUMN, --column COLUMN
- specify the column(s) to include, can be repeated
- --max-width <integer>
- Maximum display width, <1 to disable. You can also use the CLIFF_MAX_TERM_WIDTH environment variable, but the parameter takes precedence.
- --fit-width
- Fit the table to the display width. Implied if --max- width greater than 0. Set the environment variable CLIFF_FIT_WIDTH=1 to always enable
- --print-empty
- Print empty table if there is no data to show.
- --noindent
- whether to disable indenting the JSON
- --prefix PREFIX
- add a prefix to all variable names
appcontainer service enable
Enable the Zun service.
openstack appcontainer service enable [-h]
[-f {json,shell,table,value,yaml}]
[-c COLUMN]
[--max-width <integer>]
[--fit-width] [--print-empty]
[--noindent] [--prefix PREFIX]
<host> <binary>
- <host>
- Name of host
- <binary>
- Name of the binary to enable
- -h, --help
- show this help message and exit
- -f {json,shell,table,value,yaml},
- --format {json,shell,table,value,yaml}
- the output format, defaults to table
- -c COLUMN, --column COLUMN
- specify the column(s) to include, can be repeated
- --max-width <integer>
- Maximum display width, <1 to disable. You can also use the CLIFF_MAX_TERM_WIDTH environment variable, but the parameter takes precedence.
- --fit-width
- Fit the table to the display width. Implied if --max- width greater than 0. Set the environment variable CLIFF_FIT_WIDTH=1 to always enable
- --print-empty
- Print empty table if there is no data to show.
- --noindent
- whether to disable indenting the JSON
appcontainer service disable
Disable the Zun service.
openstack appcontainer service disable [-h]
[-f {json,shell,table,value,yaml}]
[-c COLUMN]
[--max-width <integer>]
[--fit-width] [--print-empty]
[--noindent] [--prefix PREFIX]
[--reason <reason>]
<host> <binary>
- <host>
- Name of host
- <binary>
- Name of the binary to disable
- -h, --help
- show this help message and exit
- --reason <reason>
- Reason for disabling service
- -f {json,shell,table,value,yaml},
- --format {json,shell,table,value,yaml}
- the output format, defaults to table
- -c COLUMN, --column COLUMN
- specify the column(s) to include, can be repeated
- --max-width <integer>
- Maximum display width, <1 to disable. You can also use the CLIFF_MAX_TERM_WIDTH environment variable, but the parameter takes precedence.
- --fit-width
- Fit the table to the display width. Implied if --max- width greater than 0. Set the environment variable CLIFF_FIT_WIDTH=1 to always enable
- --print-empty
- Print empty table if there is no data to show.
- --noindent
- whether to disable indenting the JSON
- --prefix PREFIX
- add a prefix to all variable names
Reference
The zunclient Python API
Usage
First create a client instance with your credentials:
>>> from zunclient import client >>> zun = client.Client(VERSION, auth_url=AUTH_URL, username=USERNAME, ... password=PASSWORD, project_name=PROJECT_NAME, ... user_domain_name='default', ... project_domain_name='default')
Here VERSION can be a string or zunclient.api_versions.APIVersion obj. If you prefer string value, you can use 1 or 1.X (where X is a microversion).
Alternatively, you can create a client instance using the keystoneauth session API:
>>> from keystoneauth1 import loading
>>> from keystoneauth1 import session
>>> from zunclient import client
>>> loader = loading.get_plugin_loader('password')
>>> auth = loader.load_from_options(auth_url=AUTH_URL,
... username=USERNAME,
... password=PASSWORD,
... project_name=PROJECT_NAME,
... user_domain_name='default',
... project_domain_name='default')
>>> sess = session.Session(auth=auth)
>>> zun = client.Client(VERSION, session=sess)
If you have PROJECT_NAME instead of a PROJECT_ID, use the project_name parameter. Similarly, if your cloud uses keystone v3 and you have a DOMAIN_NAME or DOMAIN_ID, provide it as user_domain_(name|id) and if you are using a PROJECT_NAME also provide the domain information as project_domain_(name|id).
Then call methods on its managers:
>>> zun.containers.list()
[<Container {...}>]
>>> zun.containers.run(name="my-container", image='nginx')
<Container {...}>
AUTHOR
unknown
COPYRIGHT
2023, OpenStack Foundation
| October 16, 2023 | 4.6.0 |
