openstack 命令行管理十八 - instance管理 (备忘)

 

Openstak 中, 常用 nova 命令对实例进行管理

常见管理方法有,  创建, 删除,  更改(resize flavor, 冷/热迁移), 查询 等

 

列出当前 tenant 中的实例

首先需要载入 keystone 验证信息

 

[root@gz-controller-209131 ~(keystone_admin)]# cat keystonerc_admin
export OS_USERNAME=admin
export OS_TENANT_NAME=admin
export OS_PASSWORD=你的openstack密码
export OS_AUTH_URL=http://240.70.115.80:5000/v2.0/    <- keystone 连接方法
export PS1='[\u@\h \W(keystone_admin)]\$ '

使用 source 命令导入验证信息
[root@gz-controller-209131 ~(keystone_admin)]# source keystonerc_admin

 

 

 

 

 

命令帮助

 

[root@hh-yun-puppet-129021 ~(keystone_admin)]# nova help | grep -E 'boot|list|delete|stop|remove'
    absolute-limits     Print a list of absolute limits for a user
    agent-delete        Delete existing agent build.
    agent-list          List all builds.
    aggregate-delete    Delete the aggregate.
    aggregate-list      Print a list of all aggregates.
    aggregate-remove-host
    availability-zone-list
    boot                Boot a new server.
    cloudpipe-list      Print a list of all cloudpipe instances.
    delete              Immediately shut down and delete specified server(s).
    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
    flavor-access-list  Print access information about the given flavor.
    flavor-access-remove
    flavor-delete       Delete a specific flavor
    flavor-list         Print a list of available 'flavors' (sizes of
    floating-ip-bulk-delete
                        Bulk delete floating ips by range.
    floating-ip-bulk-list
    floating-ip-delete  De-allocate a floating IP.
    floating-ip-list    List floating ips for this tenant.
    floating-ip-pool-list
    host-list           List all hosts by service.
    hypervisor-list     List hypervisors.
    image-delete        Delete specified image(s).
    image-list          Print a list of available images to boot from.
    interface-list      List interfaces attached to a server.
    keypair-delete      Delete keypair given by its name.
    keypair-list        Print a list of keypairs for a user
    list                List active servers.
    list-secgroup       List Security Group(s) of a server.
    network-list        Print a list of available networks.
    quota-delete        Delete quota for a tenant/user so their quota will
    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.
    secgroup-delete     Delete a security group.
    secgroup-delete-group-rule
    secgroup-delete-rule
    secgroup-list       List security groups for the current tenant.
    secgroup-list-rules
    server-group-delete
    server-group-list   Print a list of all server groups.
    service-list        Show a list of all running services. Filter by host &
    stop                Stop a server.
    usage-list          List usage data for all tenants.
    volume-delete       Remove volume(s).
    volume-list         List all the volumes.
    volume-snapshot-delete
    volume-snapshot-list
    volume-type-delete  Delete a specific flavor
    volume-type-list    Print a list of available 'volume types'.
    instance-action-list
    force-delete        Force delete a server.
    restore             Restore a soft-deleted server.
    net-delete          Delete a network
    net-list            List networks
    baremetal-interface-list
    baremetal-interface-remove
    baremetal-node-delete
    baremetal-node-list
                        Print list of available baremetal nodes.
    migration-list      Print a list of migrations.
    list-extensions     List all the os-api extensions that are available.

 

 

 

 

 

 

创建主机相关帮助

[root@station140 ~(keystone_admin)]# nova boot
usage: nova boot [--flavor <flavor>] [--image <image>]
                 [--image-with <key=value>] [--boot-volume <volume_id>]
                 [--snapshot <snapshot_id>] [--num-instances <number>]
                 [--meta <key=value>] [--file <dst-path=src-path>]
                 [--key-name <key-name>] [--user-data <user-data>]
                 [--availability-zone <availability-zone>]
                 [--security-groups <security-groups>]
                 [--block-device-mapping <dev-name=mapping>]
                 [--block-device key1=value1[,key2=value2...]]
                 [--swap <swap_size>]
                 [--ephemeral size=<size>[,format=<format>]]
                 [--hint <key=value>]
                 [--nic <net-id=net-uuid,v4-fixed-ip=ip-addr,port-id=port-uuid>]
                 [--config-drive <value>] [--poll]
                 <name>


列出flavor-list

[root@hh-yun-puppet-129021 ~(keystone_admin)]# nova flavor-list
+--------------------------------------+-----------------+-----------+------+-----------+------+-------+-------------+-----------+
| ID                                   | Name            | Memory_MB | Disk | Ephemeral | S
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

Terry_Tsang

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

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

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

打赏作者

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

抵扣说明:

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

余额充值