openstack中glance命令大全

本文档详细介绍了如何使用 Glance 命令行界面 (CLI) 工具来操作 OpenStack 中的镜像服务。包括如何设置认证信息、指定 API 版本、配置 SSL 相关选项等。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

usage: glance [--version] [-d] [-v] [--get-schema] [--no-ssl-compression] [-f]
              [--os-image-url OS_IMAGE_URL]
              [--os-image-api-version OS_IMAGE_API_VERSION]
              [--profile HMAC_KEY] [--insecure] [--os-cacert <ca-certificate>]
              [--os-cert <certificate>] [--os-key <key>] [--timeout <seconds>]
              [--os-auth-url OS_AUTH_URL] [--os-domain-id OS_DOMAIN_ID]
              [--os-domain-name OS_DOMAIN_NAME]
              [--os-project-id OS_PROJECT_ID]
              [--os-project-name OS_PROJECT_NAME]
              [--os-project-domain-id OS_PROJECT_DOMAIN_ID]
              [--os-project-domain-name OS_PROJECT_DOMAIN_NAME]
              [--os-trust-id OS_TRUST_ID] [--os-user-id OS_USER_ID]
              [--os-user-name OS_USERNAME]
              [--os-user-domain-id OS_USER_DOMAIN_ID]
              [--os-user-domain-name OS_USER_DOMAIN_NAME]
              [--os-password OS_PASSWORD] [--key-file OS_KEY]
              [--ca-file OS_CACERT] [--cert-file OS_CERT]
              [--os-tenant-id OS_TENANT_ID] [--os-tenant-name OS_TENANT_NAME]
              [--os-region-name OS_REGION_NAME]
              [--os-auth-token OS_AUTH_TOKEN]
              [--os-service-type OS_SERVICE_TYPE]
              [--os-endpoint-type OS_ENDPOINT_TYPE]


Command-line interface to the OpenStack Images API.


Optional arguments:
  --version             show program's version number and exit
  -d, --debug           Defaults to env[GLANCECLIENT_DEBUG].
  -v, --verbose         Print more verbose output.
  --get-schema          Ignores cached copy and forces retrieval of schema
                        that generates portions of the help text. Ignored with
                        API version 1.
  --no-ssl-compression  DEPRECATED! This option is deprecated and not used
                        anymore. SSL compression should be disabled by default
                        by the system SSL library.
  -f, --force           Prevent select actions from requesting user
                        confirmation.
  --os-image-url OS_IMAGE_URL
                        Defaults to env[OS_IMAGE_URL]. If the provided image
                        url contains a version number and `--os-image-api-
                        version` is omitted the version of the URL will be
                        picked as the image api version to use.
  --os-image-api-version OS_IMAGE_API_VERSION
                        Defaults to env[OS_IMAGE_API_VERSION] or 2.
  --profile HMAC_KEY    HMAC key to use for encrypting context data for
                        performance profiling of operation. This key should be
                        the value of HMAC key configured in osprofiler
                        middleware in glance, it is specified in paste
                        configuration file at /etc/glance/api-paste.ini and
                        /etc/glance/registry-paste.ini. Without key the
                        profiling will not be triggered even if osprofiler is
                        enabled on server side.
  --insecure            Explicitly allow client to perform "insecure" TLS
                        (https) requests. The server's certificate will not be
                        verified against any certificate authorities. This
                        option should be used with caution.
  --os-cacert <ca-certificate>
                        Specify a CA bundle file to use in verifying a TLS
                        (https) server certificate. Defaults to
                        env[OS_CACERT].
  --os-cert <certificate>
                        Defaults to env[OS_CERT].
  --os-key <key>        Defaults to env[OS_KEY].
  --timeout <seconds>   Set request timeout (in seconds).
  --os-auth-url OS_AUTH_URL
                        Authentication URL
  --os-domain-id OS_DOMAIN_ID
                        Domain ID to scope to
  --os-domain-name OS_DOMAIN_NAME
                        Domain name to scope to
  --os-project-id OS_PROJECT_ID
                        Project ID to scope to
  --os-project-name OS_PROJECT_NAME
                        Project name to scope to
  --os-project-domain-id OS_PROJECT_DOMAIN_ID
                        Domain ID containing project
  --os-project-domain-name OS_PROJECT_DOMAIN_NAME
                        Domain name containing project
  --os-trust-id OS_TRUST_ID
                        Trust ID
  --os-user-id OS_USER_ID
                        User ID
  --os-user-name OS_USERNAME, --os-username OS_USERNAME
                        Username
  --os-user-domain-id OS_USER_DOMAIN_ID
                        User's domain id
  --os-user-domain-name OS_USER_DOMAIN_NAME
                        User's domain name
  --os-password OS_PASSWORD
                        User's password
  --key-file OS_KEY     DEPRECATED! Use --os-key.
  --ca-file OS_CACERT   DEPRECATED! Use --os-cacert.
  --cert-file OS_CERT   DEPRECATED! Use --os-cert.
  --os-tenant-id OS_TENANT_ID
                        Defaults to env[OS_TENANT_ID].
  --os-tenant-name OS_TENANT_NAME
                        Defaults to env[OS_TENANT_NAME].
  --os-region-name OS_REGION_NAME
                        Defaults to env[OS_REGION_NAME].
  --os-auth-token OS_AUTH_TOKEN
                        Defaults to env[OS_AUTH_TOKEN].
  --os-service-type OS_SERVICE_TYPE
                        Defaults to env[OS_SERVICE_TYPE].
  --os-endpoint-type OS_ENDPOINT_TYPE
                        Defaults to env[OS_ENDPOINT_TYPE].


See "glance help COMMAND" for help on a specific command.


Run `glance --os-image-api-version 1 help` for v1 help
### 如何卸载或移除 OpenStack Glance 组件 对于希望彻底清除并重置 OpenStackGlance 部分,以下是具体操作方法: #### 停止Glance服务 确保所有与 Glance 相关的服务都已停止运行。这一步骤非常重要,因为正在运行的服务可能会阻止文件被删除或者更新。 ```bash systemctl stop openstack-glance-api.service systemctl stop openstack-glance-registry.service ``` #### 卸载Glance软件包 使用 `yum` 工具来安全地移除 Glance 及其关联的软件包,这样可以避免因手动删除而可能引发的问题[^1]。 ```bash yum remove openstack-glance python-glanceclient glance* ``` 上述命令会尝试移除所有的 Glance 主要组件以及客户端工具。请注意,在执行此命令前应当确认这些包确实是要完全去除的目标;如果有其他应用依赖于其中某些库,则需谨慎考虑。 #### 清理残留配置和数据 为了确保系统干净无残留,还需要清理数据库中的表结构以及其他存储位置的数据。假设使用 MySQL/MariaDB 作为后端数据库引擎的话,可以通过 SQL 客户端连接到相应的实例上去删除对应的 schema 或者 drop tables。 ```sql DROP DATABASE glance; DELETE FROM mysql.user WHERE user='glance'; FLUSH PRIVILEGES; ``` 另外也要记得清空镜像存放路径下的内容,默认情况下位于 `/var/lib/glance/images/` 文件夹内。 #### 移除相关用户和服务注册项 最后一步是在 Keystone 中注销掉 Glance 用户及其 endpoint 记录。登录 keystone 并执行如下指令完成最终收尾工作: ```bash openstack service delete $(openstack service list | grep image | awk '{print $2}') openstack endpoint delete $(openstack endpoint list | grep image | awk '{print $2}') openstack role assignment list --user glance --project service | grep glance | cut -d' ' -f4 | xargs -n1 openstack role assignment delete openstack user delete glance ``` 以上过程涵盖了从停止服务直到清理用户的整个流程,从而实现对 OpenStack Glance 组件的安全有效移除[^2]。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Poo_Chai

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值