nova 命令演示

——nova命令解释

首先,通过nova-manage version查看nova版本
2014.2.3
#nova --version
2.20.0
运行nova help 命令,可以得到如下信息:

nova help
usage: nova [--version] [--debug] [--os-cache] [--timings]
            [--timeout <seconds>] [--os-auth-token OS_AUTH_TOKEN]
            [--os-username <auth-user-name>] [--os-password <auth-password>]
            [--os-tenant-name <auth-tenant-name>]
            [--os-tenant-id <auth-tenant-id>] [--os-auth-url <auth-url>]
            [--os-region-name <region-name>] [--os-auth-system <auth-system>]
            [--service-type <service-type>] [--service-name <service-name>]
            [--volume-service-name <volume-service-name>]
            [--endpoint-type <endpoint-type>]
            [--os-compute-api-version <compute-api-ver>]
            [--os-cacert <ca-certificate>] [--insecure]
            [--bypass-url <bypass-url>]
            <subcommand> ...

Command-line interface to the OpenStack Nova API.

Positional arguments:
  <subcommand>
    absolute-limits     Print a list of absolute limits for a user
    add-fixed-ip        Add new IP address on a network to server.
    add-floating-ip     DEPRECATED, use floating-ip-associate instead.
    add-secgroup        Add a Security Group to a server.
    agent-create        Create new agent build.
    agent-delete        Delete existing agent build.
    agent-list          List all builds.
    agent-modify        Modify existing agent build.
    aggregate-add-host  Add the host to the specified aggregate.
    aggregate-create    Create a new aggregate with the specified details.
    aggregate-delete    Delete the aggregate.
    aggregate-details   Show details of the specified aggregate.
    aggregate-list      Print a list of all aggregates.
    aggregate-remove-host
                        Remove the specified host from the specified
                        aggregate.
    aggregate-set-metadata
                        Update the metadata associated with the aggregate.
    aggregate-update    Update the aggregate's name and optionally
                        availability zone.
    availability-zone-list
                        List all the availability zones.
    backup              Backup a server by creating a 'backup' type snapshot.
    boot                Boot a new server.
    change-vnc-password
                        Change vnc password of a server, need hard reboot to
                        enable.
    clear-password      Clear password for a server.
    cloudpipe-configure
                        Update the VPN IP/port of a cloudpipe instance.
    cloudpipe-create    Create a cloudpipe instance for the given project.
    cloudpipe-list      Print a list of all cloudpipe instances.
    console-log         Get console log output of a server.
    credentials         Show user credentials returned from auth.
    delete              Immediately shut down and delete specified server(s).
    diagnostics         Retrieve server diagnostics.
    dns-create          Create a DNS entry for domain, name and ip.
    dns-create-private-domain
                        Create the specified DNS domain.
    dns-create-public-domain
                        Create the specified DNS domain.
    dns-delete          Delete the specified DNS entry.
    dns-delete-domain   Delete the specified DNS domain.
    dns-domains         Print a list of available dns domains.
    dns-list            List current DNS entries for domain and ip or domain
                        and name.
    endpoints           Discover endpoints that get returned from the
                        authenticate services.
    evacuate            Evacuate server from failed host.
    fixed-ip-get        Retrieve info on a fixed ip.
    fixed-ip-reserve    Reserve a fixed IP.
    fixed-ip-unreserve  Unreserve a fixed IP.
    flavor-access-add   Add flavor access for the given tenant.
    flavor-access-list  Print access information about the given flavor.
    flavor-access-remove
                        Remove flavor access for the given tenant.
    flavor-create       Create a new flavor
    flavor-delete       Delete a specific flavor
    flavor-key          Set or unset extra_spec for a flavor.
    flavor-list         Print a list of available 'flavors' (sizes of
                        servers).
    flavor-show         Show details about the given flavor.
    floating-ip-associate
                        Associate a floating IP address to a server.
    floating-ip-bulk-create
                        Bulk create floating ips by range.
    floating-ip-bulk-delete
                        Bulk delete floating ips by range.
    floating-ip-bulk-list
                        List all floating ips.
    floating-ip-create  Allocate a floating IP for the current tenant.
    floating-ip-delete  De-allocate a floating IP.
    floating-ip-disassociate
                        Disassociate a floating IP address from a server.
    floating-ip-list    List floating ips for this tenant.
    floating-ip-pool-list
                        List all floating ip pools.
    get-host-names-by-tags
                        get host list with tag.
    get-password        Get password for a server.
    get-rdp-console     Get a rdp console to a server.
    get-spice-console   Get a spice console to a server.
    get-vnc-console     Get a vnc console to a server.
    host-action         Perform a power action on a host.
    host-describe       Describe a specific host.
    host-list           List all hosts by service.
    host-update         Update host settings.
    hypervisor-list     List hypervisors.
    hypervisor-servers  List servers belonging to specific hypervisors.
    hypervisor-show     Display the details of the specified hypervisor.
    hypervisor-stats    Get hypervisor statistics over all compute nodes.
    hypervisor-update-ratio
                        Update host ratio tag.
    hypervisor-uptime   Display the uptime of the specified hypervisor.
    image-check-exists  Check the given image whether on host or not.
    image-create        Create a new image by taking a snapshot of a running
                        server.
    image-delete        Delete specified image(s).
    image-fetch         Fetch the given image to host.
    image-list          Print a list of available images to boot from.
    image-meta          Set or Delete metadata on an image.
    image-show          Show details about the given image.
    inject-public-key   Inject new public key to a server.
    interface-attach    Attach a network interface to a server.
    interface-detach    Detach a network interface from a server.
    interface-list      List interfaces attached to a server.
    keypair-add         Create a new key pair for use with servers.
    keypair-delete      Delete keypair given by its name.
    keypair-list        Print a list of keypairs for a user
    keypair-show        Show details about the given keypair.
    list                List active servers.
    list-secgroup       List Security Group(s) of a server.
    live-migration      Migrate running server to a new machine.
    live-migration-abort
                        abort server live migration.
    live-migration-force-complete
                        force complete server live migration.
    live-resize         LiveResize a server.
    lock                Lock a server.
    meta                Set or Delete metadata on a server.
    migrate             Migrate a server. The new host will be selected by the
                        scheduler.
    network-associate-host
                        Associate host with network.
    network-associate-project
                        Associate project with network.
    network-create      Create a network.
    network-disassociate
                        Disassociate host and/or project from the given
                        network.
    network-list        Print a list of available networks.
    network-show        Show details about the given network.
    pause               Pause a server.
    port-map            Map a port to a host.
    port-unmap          Unmap a port from a host.
    prechose-lm-dest    pre chose destinations for live migration.
    quota-class-show    List the quotas for a quota class.
    quota-class-update  Update the quotas for a quota class.
    quota-defaults      List the default quotas for a tenant.
    quota-delete        Delete quota for a tenant/user so their quota will
                        Revert back to default.
    quota-show          List the quotas for a tenant/user.
    quota-update        Update the quotas for a tenant/user.
    rate-limits         Print a list of rate limits for a user
    reboot              Reboot a server.
    rebuild             Shutdown, re-image, and re-boot a server.
    remove-fixed-ip     Remove an IP address from a server.
    remove-floating-ip  DEPRECATED, use floating-ip-disassociate instead.
    remove-secgroup     Remove a Security Group from a server.
    rename              Rename a server.
    rescue              Rescue a server.
    reset-network       Reset network of a server.
    reset-pci           Reset pci device for a server.
    reset-state         Reset the state of a server.
    resize              Resize a server.
    resize-confirm      Confirm a previous resize.
    resize-revert       Revert a previous resize (and return to the previous
                        VM).
    resume              Resume a server.
    root-password       Change the root password for a server.
    scrub               Delete data associated with the project.
    secgroup-add-group-rule
                        Add a source group rule to a security group.
    secgroup-add-rule   Add a rule to a security group.
    secgroup-create     Create a security group.
    secgroup-delete     Delete a security group.
    secgroup-delete-group-rule
                        Delete a source group rule from a security group.
    secgroup-delete-rule
                        Delete a rule from a security group.
    secgroup-list       List security groups for the current tenant.
    secgroup-list-rules
                        List rules for a security group.
    secgroup-update     Update a security group.
    server-group-add-member
                        Add member to server group.
    server-group-create
                        Create a server group.
    server-group-delete
                        Delete the server group.
    server-group-list   List server group.
    server-group-remove-member
                        Remove member from server group.
    server-group-show   Show the server group.
    service-delete      Delete the service.
    service-disable     Disable the service.
    service-enable      Enable the service.
    service-list        Show a list of all running services. Filter by host &
                        binary.
    shelve              Shelve a server.
    shelve-offload      Remove a shelved server from the compute node.
    show                Show details about the given server.
    snapshot-convert    Convert a snapshot to image.
    snapshot-create     Create an incremental snapshot for server.
    snapshot-delete     Delete a snapshot.
    snapshot-list       List all snapshots.
    snapshot-reset-state
                        Reset the status of a snapshot.
    snapshot-rollback   Rollback instance disk to snapshot.
    snapshot-show       Show details about a snapshot.
    ssh                 SSH into a server.
    start               Start a server.
    stop                Stop a server.
    suspend             Suspend a server.
    tag-bind            bind tag to host.
    tag-create          Create a new tag with the specified details.
    tag-delete          Delete the tag.
    tag-get-hosts       get host list with tag.
    tag-list            List all the tags.
    tag-show            show the tag.
    tag-type-create     Create a new tag type with the specified details.
    tag-type-delete     Delete the tag type.
    tag-type-key        Set or unset extra_spec for a tag type.
    tag-type-list       List all the tags.
    tag-type-show       Show the tag type.
    tag-unbind          unbind tag from host.
    tag-update          Create a new tag with the specified details.
    unlock              Unlock a server.
    unpause             Unpause a server.
    unrescue            Unrescue a server.
    unshelve            Unshelve a server.
    update-instance-qos
                        Update Qos metadata on an instance.
    update-qos          Update Qos metadata on a volume.
    usage               Show usage data for a single tenant.
    usage-list          List usage data for all tenants.
    volume-attach       Attach a volume to a server.
    volume-create       Add a new volume.
    volume-create-attach
                        Create a volume and attach it to a server.
    volume-delete       Remove volume(s).
    volume-detach       Detach a volume from a server.
    volume-list         List all the volumes.
    volume-live-extend  Extend an attached volume.
    volume-map          Map a volume to a host.
    volume-revert       Revert a volume to a snapshot.
    volume-show         Show details about a volume.
    volume-snapshot-create
                        Add a new snapshot.
    volume-snapshot-delete
                        Remove a snapshot.
    volume-snapshot-list
                        List all the snapshots.
    volume-snapshot-show
                        Show details about a snapshot.
    volume-type-create  Create a new volume type.
    volume-type-delete  Delete a specific flavor
    volume-type-list    Print a list of available 'volume types'.
    volume-unmap        Unmap a volume from a host.
    volume-update       Update volume attachment.
    x509-create-cert    Create x509 cert for a user in tenant.
    x509-get-root-cert  Fetch the x509 root cert.
    bash-completion     Prints all of the commands and options to stdout so
                        that the nova.bash_completion script doesn't have to
                        hard code them.
    help                Display help about this program or one of its
                        subcommands.
    cell-capacities     Get cell capacities for all cells or a given cell.
    cell-show           Show details of a given cell.
    force-delete        Force delete a server.
    restore             Restore a soft-deleted server.
    migration-cleanup   cleanup uncompleted live migration(only support live-
                        migration).
    migration-list      Print a list of migrations.
    baremetal-interface-add
                        Add a network interface to a baremetal node.
    baremetal-interface-list
                        List network interfaces associated with a baremetal
                        node.
    baremetal-interface-remove
                        Remove a network interface from a baremetal node.
    baremetal-node-create
                        Create a baremetal node.
    baremetal-node-delete
                        Remove a baremetal node and any associated interfaces.
    baremetal-node-list
                        Print list of available baremetal nodes.
    baremetal-node-show
                        Show information about a baremetal node.
    net                 Show a network
    net-create          Create a network
    net-delete          Delete a network
    net-list            List networks
    instance-action     Show an action.
    instance-action-list
                        List actions on a server.
    host-servers-migrate
                        Migrate all instances of the specified host to other
                        available hosts.
    list-extensions     List all the os-api extensions that are available.
    host-evacuate       Evacuate all instances from failed host.
    host-meta           Set or Delete metadata on all instances of a host.

Optional arguments:
  --version             show program's version number and exit
  --debug               Print debugging output
  --os-cache            Use the auth token cache. Defaults to False if
                        env[OS_CACHE] is not set.
  --timings             Print call timing info
  --timeout <seconds>   Set HTTP call timeout (in seconds)
  --os-auth-token OS_AUTH_TOKEN
                        Defaults to env[OS_AUTH_TOKEN]
  --os-username <auth-user-name>
                        Defaults to env[OS_USERNAME].
  --os-password <auth-password>
                        Defaults to env[OS_PASSWORD].
  --os-tenant-name <auth-tenant-name>
                        Defaults to env[OS_TENANT_NAME].
  --os-tenant-id <auth-tenant-id>
                        Defaults to env[OS_TENANT_ID].
  --os-auth-url <auth-url>
                        Defaults to env[OS_AUTH_URL].
  --os-region-name <region-name>
                        Defaults to env[OS_REGION_NAME].
  --os-auth-system <auth-system>
                        Defaults to env[OS_AUTH_SYSTEM].
  --service-type <service-type>
                        Defaults to compute for most actions
  --service-name <service-name>
                        Defaults to env[NOVA_SERVICE_NAME]
  --volume-service-name <volume-service-name>
                        Defaults to env[NOVA_VOLUME_SERVICE_NAME]
  --endpoint-type <endpoint-type>
                        Defaults to env[NOVA_ENDPOINT_TYPE] or publicURL.
  --os-compute-api-version <compute-api-ver>
                        Accepts 1.1 or 3, defaults to
                        env[OS_COMPUTE_API_VERSION].
  --os-cacert <ca-certificate>
                        Specify a CA bundle file to use in verifying a TLS
                        (https) server certificate. Defaults to env[OS_CACERT]
  --insecure            Explicitly allow novaclient to perform "insecure" SSL
                        (https) requests. The server's certificate will not be
                        verified against any certificate authorities. This
                        option should be used with caution.
  --bypass-url <bypass-url>
                        Use this API endpoint instead of the Service Catalog

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


其中前面的部分是需要加载的一些环境变量,包括租户名称、用户ID、密码等,为了对其进行相应的权限验证和审核功能,其中CLI命令的主要包括以下内容:
absolute-limits 为用户得到一个完全限制列表
add-fixed-ip 给虚拟机绑定一个固定IP地址
add-floating-ip 给虚拟机绑定一个浮动IP
add-secgroup 给虚拟机添加一个安全组
agent-create 创建一个新的agent
agent-delete 删除一个已经存在的agent
agent-list 列举所有的agent信息
agent-modify 修改已经存在的agent信息
aggregate-add-host 将计算节点添加到指定的主机集合
aggregate-create 创建一个新的主机集合
aggregate-delete 删除指定的主机集合
aggregate-details 显示指定主机集合的详细信息
aggregate-list 列举所有主机集合的详细信息
aggregate-remove-host 将计算节点从指定主机集合中移除。
aggregate-set-metadata 更新制定主机集合的元数据信息,主要指az信息。
aggregate-update 更新一个主机集合的名称或者其可用域信息
availability-zone-list 列举所有的可用域信息
backup 通过创建一个backup类型的快照来备份虚拟机
boot 启动一个新的虚拟机
clear-password Clear the admin password for a server.
cloudpipe-configure 更新cloudpipe instance ××× IP/port 
cloudpipe-create 基于指定的项目创建一个cloudpipe instance
cloudpipe-list 列举所有的cloudpipe instances
console-log 获得一台虚拟机的操作台日志
credentials 显示从auth返回的用户凭证
delete 直接关闭并删除一个或者多个虚拟机
diagnostics 获取虚拟机CPU、内存等的使用情况
dns-create 根据domain、名字和IP创建一个DNS
dns-create-private-domain 创建一个指定的私有的DNS domain
dns-create-public-domain 创建一个指定的公有的DNS domain
dns-delete 删除一个指定的DNS
dns-delete-domain 删除一个指定的 DNS domain.
dns-domains 列举出可用的dns domains.
dns-list 列举dns信息
endpoints 从认证服务返回的端口信息
evacuate 从故障主机疏散撤离虚拟机
fixed-ip-get 获取固定ip的信息
fixed-ip-reserve 给虚拟机预留固定IP
fixed-ip-unreserve 虚拟机取消预留固定IP
flavor-access-add 将指定的flavor 添加到指定的 tenant
flavor-access-list 列出flavor的使用信息

flavor-access-remove 从指定的租户移除flavor使用权
flavor-create 生成新的flavor
flavor-delete 删除一个指定的flavor
flavor-key 为flavor设置或取消extra_spec
flavor-list 列举出所有可用的flavor
flavor-show 显示指定flavor的信息
floating-ip-associate 给虚拟机分配一个浮动IP
floating-ip-bulk-create 创建浮动IP地址段
floating-ip-bulk-delete 删除浮动IP地址段
floating-ip-bulk-list 列举浮动IP地址段
floating-ip-create 为当前租户分配一个浮动IP
floating-ip-delete 删除浮动IP
floating-ip-disassociate 解绑浮动IP
floating-ip-list 显示所有浮动IP
floating-ip-pool-list 显示所有浮动IP地址池
get-password 获取虚拟机的admin密码, 此操作调用元数据服务来请求元数据信息,并不是从虚拟机里读取其密码信息
get-rdp-console 获得虚拟机rdp控制台
get-serial-console 获得虚拟机serial 控制台
get-spice-console 获得虚拟机spice控制台
get-vnc-console 获得虚拟机vnc控制台
host-action 开启、关闭或者重启计算节点
host-describe 显示计算节点的描述信息
host-list 列举所有节点以及服务
host-update 更新节点的状态信息
hypervisor-list 列举出所有计算节点的信息
hypervisor-servers 列举出一个计算节点下的所有虚拟机
hypervisor-show 显示一台计算节点的详细信息
hypervisor-stats 获取所有计算节点的统计信息
hypervisor-uptime 获取指定计算节点的更新时间
image-create 通过虚拟机快照创建一个镜像
image-delete 删除指定镜像
image-list 获取镜像列表
image-meta 设置或者删除镜像的元数据信息
image-show 显示指定镜像的详细信息
interface-attach 给虚拟机挂载一块网卡
interface-detach 从虚拟机上卸载一块网卡
interface-list 获取指定虚拟机上所有挂载的网卡
keypair-add 创建密钥对
keypair-delete 根据名字删除密钥对
keypair-list 针对当前用户列举其密钥对
keypair-show 显示密钥对的详细信息
list 列举当前用户所有虚拟机
list-secgroup 列举指定虚拟机的所有的安全组
live-migration 执迁移
lock Lock a server.
meta 设置或者删除虚拟机的元数据
migrate 冷迁移
network-associate-host 将网络分配给某个节点
network-associate-project 将网络分配给当前租户
network-create 创建网络
network-delete 删除网络 
network-disassociate 将节点或者租户从指定网络中解除
network-list 列举网络列表
network-show 显示指定的网络
pause 暂停虚拟机 (可通过unpause恢复虚拟机)
quota-class-show 列出配额类的配额
quota-class-update 更新配额类的配额
quota-defaults 列出了一个租户的默认配额
quota-delete 删除配额,将恢复默认配额
quota-show 显示用户或者租户的配额情况
quota-update 更新用户或者租户的配额情况
rate-limits Print a list of rate limits for a user
reboot 重启虚拟机
rebuild 关闭、重传镜像并重启虚拟机
refresh-network 刷新网络
remove-fixed-ip 从虚拟机移除固定IP
remove-floating-ip 移除浮动IP
remove-secgroup 从虚拟机移除安全组
rename 重命名虚拟机
rescue 重启虚拟机进入修复模式,从初始镜像或者指定镜像启动,挂载的当前的启动盘作为第二块盘。
reset-network 重置虚拟机网络
reset-state 重置虚拟机状态
resize 调整虚拟机配置
resize-confirm 确认调整配置
resize-revert 取消调整配置,恢复到之前的状态
resume 恢复虚拟机
root-password Change the root password for a server.
scrub 删除绑定在一个租户下的网络和安全组
secgroup-add-default-rule 给默认安全组添加规则
secgroup-add-group-rule 给安全组添加新的组规则
secgroup-add-rule 给安全组增加规则。
secgroup-create 创建安全组
secgroup-delete 删除安全组.
secgroup-delete-default-rule 给默认安全组删除规则
secgroup-delete-group-rule 给安全组删除组规则
secgroup-delete-rule 给安全组删除规则
secgroup-list 当前租户的安全组列表
secgroup-list-default-rules 默认安全组的列表规则
secgroup-list-rules 列举安全组规则
secgroup-update 更新指定的安全组
server-group-create 创建server_group
server-group-delete 删除server_group
server-group-get 获得server_group
server-group-list 获取server_group信息
service-delete 删除服务
service-disable 关闭服务
service-enable 开机自启服务
service-list 获取所有的服务,并通过 host & binary过滤
shelve Shelve虚拟机
shelve-offload 从计算节点移除一个搁置的虚拟机
show 显示指定虚拟机的详细信息
ssh ssh到指定虚拟机
start 开启指定虚拟机
stop 停止指定虚拟机
suspend 挂起指定虚拟机
unlock 解锁指定虚拟机
unpause 取消暂停的虚拟机
unrescue 重启虚拟机从正常状态
unshelve unshelve虚拟机
usage 为指定的租户显示器资源使用情况
usage-list 列示所有租户的使用情况
volume-attach 给指定虚拟机挂载云硬盘
volume-create 创建一个云硬盘
volume-delete 删除一个云硬盘
volume-detach 从虚拟机上卸载云硬盘
volume-list 列举所有云硬盘
volume-show 显示指定云硬盘的详细信息
volume-snapshot-create 创建云硬盘快照
volume-snapshot-delete 删除云硬盘快照
volume-snapshot-list 云硬盘快照列表
volume-snapshot-show 显示指定云硬盘快照详细信息
volume-type-create 创建云硬盘类型
volume-type-delete 删除云硬盘类型
volume-type-list 更新云硬盘挂载信息。
volume-update 更新卷附件
x509-create-cert 为租户的用户创建了x509证书
x509-get-root-cert 获取x509根证书
bash-completion 列示出所有命令的可选项
help 显示帮助信息
net 显示网络信息
net-create 创建一个网络
net-delete 删除一个网络
net-list 列示网络(获取不到时可用#neutron net-list )
instance-action 显示虚拟机action的Request
instance-action-list 显示虚拟机的actions
baremetal-interface-add 为baremetal节点添加一个网络接口
baremetal-interface-list 列示baremetal节点的网络接口
baremetal-interface-remove 移除baremetal节点的网络接口
baremetal-node-create 创建一个baremetal节点
baremetal-node-delete 从baremetal节点移除一个网络接口
baremetal-node-list 列示可用的baremetal节点。
baremetal-node-show 列示指定的baremetal节点
cell-capacities Get cell capacities for all cells or a given
cell.
cell-show Show details of a given cell.
force-delete 强制删除虚拟机
restore 恢复一个软删除的虚拟机
host-evacuate 从故障节点中疏散所有虚拟机
migration-list 列示迁移列表
list-extensions 列出所有可用的os - api扩展
host-servers-migrate 将指定主机的所有实例迁移到其他可用主机
host-meta 在主机的所有实例上设置或删除元数据

后面将从功能方面对这些命令进行划分,然后叙述常见命令的具体使用方法

nova 命令汇总二

——存储相关命令

上一节列举了所有的nova CLI 命令,对这些命令有了一个初步地认识,接下来我把这些命令大致分成了三类,主要包括与存储资源相关的操作命令、与网络资源相关的操作命令以及与计算资源相关的操作命令,也正对应了openstack的三个核心。这一节首先叙述与存储资源相关的操作命令的具体使用方法和各个参数代表的含义。
和存储资源相关的操作,也即是和volume相关的操作,主要包括:volume-attach、volume-create、volume-delete、volume-detach、volume-list、volume-show、volume-snapshot-create、volume-snapshot-delete、volume-snapshot-list、volume-snapshot-show、volume-type-create、volume-type-delete、volume-type-list以及volume-update。

  1.volume-attach

    功能:给指定虚拟机挂载云硬盘

    用法: nova volume-attach <server> <volume> [<device>]

    参数: <server> 虚拟机的名称或者UUID; <volume> 要挂载的云硬盘的ID; [<device>] 设备的名称,例如/dev/vdb

  2.volume-create

    功能: 创建一个云硬盘

    用法: nova volume-create <size>

    参数: <size> 创建云硬盘的大小

  3.volume-delete

    功能:删除一个云硬盘

    用法: nova volume-delete <volume>

    参数: <volume> 删除云硬盘的ID或者名称

  4.volume-detach

    功能:从虚拟机上卸载云硬盘

    用法: nova volume-detach <server> <volume>

    参数: <server> 虚拟机的名称或者UUID;<volume> 要卸载云硬盘的ID

   5.volume-list

    功能:列举所有云硬盘

    用法: nova volume-list [--all-tenants [<0|1>]]

    参数: [--all-tenants [<0|1>]] 所有租户的云硬盘(仅admin可用)

  6.volume-show

    功能:显示指定云硬盘的详细信息

    用法: nova volume-show <volume>

    参数: <volume> 要查看云硬盘的ID或者名称

   7.volume-snapshot-create

    功能:创建云硬盘快照

    用法: nova volume-snapshot-create <volume>

    参数: <volume> 要创建快照云硬盘的ID

  8.volume-snapshot-delete

    功能:删除云硬盘快照

   用法: nova volume-snapshot-delete <snapshot>

   参数: <snapshot> 要删除快照的ID

  9.volume-snapshot-list

    功能:云硬盘快照列表

    用法: nova volume-snapshot-list

   参数: 无

  10.volume-snapshot-show

    功能:显示指定云硬盘快照详细信息

   用法: nova volume-snapshot-show <snapshot>

    参数: <snapshot> 要查看云硬盘快照的ID或者名称

  11.volume-type-create

    功能:创建云硬盘类型

   用法: nova volume-type-create <name>

    参数: <name> 创建云硬盘类型的名称

  12.volume-type-delete

    功能:删除云硬盘类型

    用法: nova volume-type-delete <id>

    参数: <id> 删除云硬盘类型的ID

13.volume-type-list

    功能:列示云硬盘类型

    用法: nova volume-type-list

    参数: 无

 14.volume-update

    功能:更新云硬盘挂载信息

    用法: nova volume-update <server> <attachment> <volume>

    参数: <server> 虚拟机的名称或者UUID; <attachment> 挂载的ID; <volume> 云硬盘的ID

注意:当遇到的命令参数不清楚时,不要着急。可以用 help命令来查看用法,如:
#nova help volume-update

nova 命令汇总三

——网络相关命令

 

 

和网络相关的操作主要包括:add-fixed-ip、add-floating-ip、add-secgroup、fixed-ip-get 、fixed-ip-reserve、fixed-ip-unreserve、floating-ip-associate、floating-ip-bulk-create、floating-ip-bulk-delete、floating-ip-bulk-list、floating-ip-create、floating-ip-delete、floating-ip-disassociate、floating-ip-list 、floating-ip-pool-list、interface-attach、interface-detach、interface-list、network-associate-host、network-associate-project、network-create、network-delete、network-disassociate、network-list、network-show、refresh-network、remove-fixed-ip、remove-secgroup、reset-network、secgroup-add-default-rule、secgroup-add-group-rule、secgroup-add-rule、secgroup-create、secgroup-delete、secgroup-delete-default-rule、secgroup-delete-group-rule、secgroup-delete-rule、secgroup-list、secgroup-list-default-rules、secgroup-list-rules、secgroup-update、net、net-create、net-delete、net-list。

1.add-fixed-ip

    功能:给虚拟机绑定一个固定IP

    用法: nova add-fixed-ip <server> <network-id>

    参数: <server> 虚拟机的名称或者UUID; <network-id> 网络的ID

2.add-floating-ip

    功能:给虚拟机绑定一个浮动IP

    用法:  nova add-floating-ip [--fixed-address <fixed_address>]

                                    <server>         <address>

    参数: <server> 虚拟机的名称或者UUID; <address>浮动IP地址

3.add-secgroup

    功能:给虚拟机添加一个安全组

    用法: nova add-secgroup <server> <secgroup>

    参数: <server> 虚拟机的名称或者UUID; <secgroup> 安全组的名称或ID

4.fixed-ip-get

    功能:获取固定IP的信息

    用法: nova   fixed-ip-get <fixed-ip>

    参数: <fixed-ip> 固定IP地址

5.fixed-ip-reserve

    功能:给虚拟机预留固定IP

    用法: nova  fixed-ip-reserve <fixed-ip>

    参数: <fixed-ip> 固定IP地址

6.fixed-ip-unreserve

    功能:虚拟机取消预留固定IP

    用法: nova fixed-ip-unreserve <fixed-ip>

    参数: <fixed-ip> 固定IP地址

7.floating-ip-associate

    功能:给虚拟机分配一个浮动IP

    用法: nova floating-ip-associate [--fixed-address <fixed_address>]                                   <server> <address>

    参数: [--fixed-address <fixed_address>] 固定IP地址  <server> 虚拟机的名称或者ID <address> 需要分配的浮动IP

8.floating-ip-bulk-create

    功能:创建浮动IP地址段

    用法: nova floating-ip-bulk-create [--pool <pool>] [--interface <interface>]                                   <range>

    参数: [--pool <pool>] 地址池 [--interface <interface>] 网口 <range> 要创建的地址范围

9.floating-ip-bulk-delete

    功能:删除浮动IP地址段

    用法: nova floating-ip-bulk-delete <range> 

    参数: <range> 要删除的地址范围

10.floating-ip-bulk-list

    功能:列举浮动IP地址段

    用法: nova floating-ip-bulk-list [--host <host>]

    参数: [--host <host>] 通过host进行过滤

11.floating-ip-create

    功能:为当前租户分配一个浮动IP

    用法: nova floating-ip-create [<floating-ip-pool>]

    参数: [<floating-ip-pool>] 浮动IP池名称

12.floating-ip-delete

    功能:删除浮动IP

    用法: nova floating-ip-delete  <address>

    参数: <address>浮动IP地址

13.floating-ip-disassociate

    功能:解绑浮动IP

    用法: nova floating-ip-disassociate <server> <address>

    参数:<server> 虚拟机的名称或者ID <address> 浮动IP地址

14.floating-ip-list

    功能:显示所有浮动IP

    用法: nova floating-ip-list

    参数:无

15.floating-ip-pool-list

    功能:显示所有浮动IP地址池

    用法: nova floating-ip-pool-list

    参数:无

16.interface-attach

    功能:给虚拟机挂载一块网卡

    用法: nova interface-attach [--port-id <port_id>] [--net-id <net_id>] [--fixed-ip <fixed_ip>] <server>

    参数:port_id 端口ID  net_id 网络ID fixed_ip 固定IP地址 <server> 虚拟机的名称或者ID

17.interface-detach

    功能:从虚拟机卸载网卡

    用法: nova interface-detach <server> <port_id>

    参数: <server> 虚拟机的名称或者ID port_id 端口ID

18.interface-list

    功能:获取指定虚拟机上所有挂载的网卡

    用法: nova interface-list <server>

    参数: <server> 虚拟机的名称或者ID

19.network-associate-host

    功能:将网络分配给某个节点

    用法: nova network-associate-host <network> <host>

    参数: <network> 网络ID <host> 节点名称

20.network-associate-project

    功能:将网络分配给当前租户

    用法: nova network-associate-project <network>

    参数: <network> 网络ID

21.network-create

    功能:创建网络

    用法: nova network-create <network-label>

    参数: <network-label> 网络标签

22.nertwork-delete

    功能:删除网络

    用法: nova network-delete <network>

    参数: <network> 网络UUID

23.network-disassociate

    功能:将节点或者租户从指定网络中解除

    用法: nova network-disassociate [--host-only [<0|1>]] [--project-only [<0|1>]] <network>

    参数: <network> 网络UUID

24.network-list

    功能:列举网络列表

    用法: nova network-list

    参数: 无

25.network-show

    功能:显示指定的网络

    用法: nova network-show <network>

    参数: <network> 网络的UUID

26.refresh-network

    功能:刷新网络

    用法: nova refresh-network <network>

    参数: <network> 网络的UUID

27.remove-fixed-ip

    功能:从虚拟机移除固定IP

    用法: nova remove-fixed-ip <server> <address>

    参数: <server> 虚拟机的名称或者ID <address> IP络地址

28.remove-secgroup

    功能:从虚拟机移除安全组

    用法: nova remove-fixed-ip <server> <secgroup>

    参数: <server> 虚拟机的名称或者ID <secgroup> 安全组名称

29.reset-network

    功能:重置虚拟机网络

    用法: nova reset-network <server>

    参数: <server> 虚拟机的名称或者ID

30.secgroup-add-default-rule

    功能:给默认安全组添加规则

    用法: nova secgroup-add-default-rule <ip-proto> <from-port> <to-port> <cidr>

    参数: <ip-proto> ip协议,包括icmp、tcp、udp from-port 开始端口 to-port 结束端口 <cidr> IP CIDR范围

31.secgroup-add-group-rule

    功能:给安全组添加新的组规则

    用法: nova secgroup-add-group-rule <secgroup> <source-group> <ip-proto> <from-port> <to-port>

    参数: secgroup安全组名称或者ID source-group 源组名称或者ID ip-proto ip协议 from-port 开始端口 to-port 结束端口

32.secgroup-add-rule

    功能:给安全组添加规则

    用法: nova secgroup-add-rule <secgroup> <ip-proto> <from-port> <to-port> <cidr>

    参数: secgroup安全组名称或者ID  ip-proto ip协议 from-port 开始端口 to-port 结束 <cidr> IP CIDR范围

33.secgroup-create

    功能:创建安全组

    用法: nova secgroup-create <name> <description>

    参数: name 安全组名称 description 安全组描述

34.secgroup-delete

    功能:删除安全组

    用法: nova secgroup-delete <name>

    参数: name 安全组名称或者ID

35.secgroup-delete-default-rule

    功能:给默认安全组删除规则

    用法: nova secgroup-delete-default-rule <ip-proto> <from-port> <to-port> <cidr>

    参数: <ip-proto> ip协议,包括icmp、tcp、udp from-port 开始端口 to-port 结束端口 <cidr> IP CIDR范围

36.secgroup-delete-group-rule

    功能:给安全组删除组规则

    用法: nova secgroup-delete-group-rule <secgroup> <source-group> <ip-proto> <from-port> <to-port>

        参数: secgroup安全组名称或者ID source-group 源组名称或者ID ip-proto ip协议 from-port 开始端口 to-port 结束端口

37.secgroup-delete-rule

    功能:给安全组删除规则

    用法: nova secgroup-delete-rule <secgroup> <ip-proto> <from-port> <to-port> <cidr>

    参数: secgroup安全组名称或者ID  ip-proto ip协议 from-port 开始端口 to-port 结束 <cidr> IP CIDR范围

38.secgroup-list

    功能:列举当前租户安全组规则

    用法: nova secgroup-list [--all-tenants [<0|1>]]

    参数: [--all-tenants [<0|1>] 是否显示所有租户的安全组

39.secgroup-list-default-rules

    功能:列举所有租户默认安全组规则

    用法: nova secgroup-default-rules

    参数: 无

40.secgroup-list-rules

    功能:列举安全组规则

    用法: nova secgroup-list-rules

    参数: 无

41.secgroup-update

    功能:更新指定的安全组

    用法: nova secgroup-update <secgroup> <name> <description>

    参数: secgroup 安全组名称或者ID name 新名称 description 新描述

42. net

    功能:显示指定网络的信息

    用法: nova net <network_id>

    参数: <network_id> 指定网络的ID

43. net-create

    功能:创建一个网络

    用法: nova net-create <network_label>  <cidr>

    参数: <network_label> 网络名称  <cidr>  IP地址段

44. net-delete

    功能:创建一个网络

    用法: nova net-create <network_id>

    参数: <network_id> 网络的ID

45. net-list

    功能:列示网络(也可用#neutron net-list

    用法: nova net-list

    参数: 无

 

注意:随着版本的更新可能有的命令会不在使用,但当使用help帮助时,会看到替代它的命令。

如:nova net-create  被  nova tenant-network-create 代替

参考:https://blog.51cto.com/13788458/2128703

  • 4
    点赞
  • 18
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值