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

本文涉及的产品
云解析DNS,个人版 1个月
全局流量管理 GTM,标准版 1个月
云解析 DNS,旗舰版 1个月
简介: Openstak 中, 常用 nova 命令对实例进行管理 常见管理方法有,  创建, 删除,  更改(resize flavor, 冷/热迁移), 查询 等   列出当前 tenant 中的实例 首先需要载入 keystone 验证信息 [root@gz-controller-209131 ~(keystone_admin)]# cat keystonerc_admin

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 | Swap | VCPUs | RXTX_Factor | Is_Public |
+--------------------------------------+-----------------+-----------+------+-----------+------+-------+-------------+-----------+
| 05a60192-4e43-40ae-a2c7-d37d7e9a81b1 | 2core-8g-40g    | 8192      | 40   | 0         | 2048 | 2     | 1.0         | True      |
| 1012                                 | normal_1core    | 2048      | 20   | 0         | 1024 | 1     | 1.0         | False     |
| 12266e3a-a1fc-4f6a-83f8-fc841abce59e | b2c_allinone_8G | 8192      | 40   | 0         | 1024 | 4     | 1.0         | True      |
| 3017f87a-a3b2-46ef-8d37-ad341919b74c | 8core-8g        | 8192      | 40   | 0         | 2048 | 8     | 1.0         | True      |
| 43664714-1c93-4e7a-adbd-9e47a6a932fa | 2core-2g        | 2048      | 20   | 0         | 1024 | 2     | 1.0         | True      |
| 5c88939b-8807-4821-9718-5bafecc1daa2 | 2core-8g        | 8192      | 20   | 0         | 2048 | 2     | 1.0         | True      |
| 76269352-5050-4095-b4f3-3ea86cb2879c | 2core-2g-40g    | 2048      | 40   | 0         | 2048 | 2     | 1.0         | True      |
| 8d20b341-d0a2-47e2-acf7-73e64d76a8fe | 4core-8g        | 8192      | 40   | 0         | 2048 | 4     | 1.0         | True      |
| 989f6219-3231-45b5-bcfd-daf87ac07705 | 8core-16g       | 16384     | 40   | 0         | 2048 | 8     | 1.0         | True      |
| 9bb5f019-0c7c-41fc-a3ed-e6e44413a3d3 | 8core-32g       | 32768     | 40   | 0         | 2048 | 8     | 1.0         | True      |
| a009164a-f9fe-47fc-9876-e27dbcef1040 | mysql_db        | 4096      | 20   | 0         | 1024 | 4     | 1.0         | True      |
| bfaefcff-f01b-42fc-bdec-1e5c9fa3c0a1 | b2c_allinone    | 4096      | 40   | 0         | 1024 | 2     | 1.0         | True      |
| ced08277-a79f-491f-97eb-275d5271777e | b2c_web         | 2048      | 20   | 0         | 1024 | 2     | 1.0         | True      |
| dc98e6d6-143f-42c2-9482-ee6efb04ff7e | 4core-4g        | 4096      | 40   | 0         | 1024 | 4     | 1.0         | True      |
| de61ffb3-b1fe-46ec-99c5-390e5280e6d7 | 4core-16g       | 16384     | 40   | 0         | 2048 | 4     | 1.0         | True      |
| edd174c2-7ce1-445d-86b0-3d10705a12b1 | 2core-4g        | 4096      | 20   | 0         | 1024 | 2     | 1.0         | True      |
| f43fe47d-0be6-4c8f-ba0e-cdfa8fea04e0 | b2c_web_1core   | 2048      | 20   | 0         | 1024 | 1     | 1.0         | True      |
| ff40b4a3-fd79-444b-884b-6447e5dc3265 | 2core-4g-40g    | 4096      | 40   | 0         | 2048 | 2     | 1.0         | True      |
+--------------------------------------+-----------------+-----------+------+-----------+------+-------+-------------+-----------+


列出镜像命名

[root@hh-yun-puppet-129021 ~(keystone_admin)]# glance image-list | grep -v "+" | awk '{printf "%-35s %25s\n",  $2,$4}'
ID                                                       Name
04135fe1-14d8-4480-a638-189ed93ea620       Centos5.8_2.9.4_old
c6ce9208-70d4-4b67-ad0a-a82927dcd5b7           Centos5.8_2.9.5
8f9686dc-3286-41ab-8a03-8a107aa56b27        Centos5.8_2.9.5_v1
e624e961-52a4-4c8f-81c4-809355707147           Centos5.8_2.9.6
a1e93465-b3ab-456e-ab30-24ed6d77c11f   centos5.8_test_anquan05
f1739787-c454-4001-9253-c7c5d437aff5             Centos6.3_1.3
f87f65e3-24ff-44c0-8858-9662334679e4      Centos6.3_x86_64_1.2
764b2022-0ecf-4013-b68a-898e9c31fb46     Centos6.6_x86_64_1.10
2250a24b-c83d-4c6b-882f-87415a46ea83     Centos6.6_x86_64_1.12
301db4ff-a46f-4235-8f85-5414797377c5      Centos6.6_x86_64_1.6
3043d3e7-c565-44c1-ad5d-8efcb5e3bfe1       Centos65_x86_64_2.6
5aa770b3-8636-4532-9ffd-e1b0dca982be      Centos7_Generic_1503
dd684f6d-2bf7-489a-97dd-af04c4758d62             pdns_20140430
4fc0d2a3-b8e0-4d6b-9490-39c82a330c1b         pdns_20140430_old
0c47db9c-5f74-4544-8ada-0894c1d2c20c                      Win7
ec67eb1a-0789-4233-8b02-a6fd7cec12a1       windows-server-2012
4c91c621-c809-4989-a474-da87b5a49401       windows_server_2008
a7996093-9ae6-4dc0-b711-52f03b3a0663  windows_server_2008_v0.1
9eb26d0d-eedb-44ad-b826-03316423d167  windows_server_2012_v1.2
ebaf276d-be8b-44a8-87ff-df623bda5467  windows_server_2012_v1.3
e7905995-bc7c-4594-93d0-f989a18916fe  windows_server_2012_v1.4

等价命令

nova image-list | grep -v "+" | awk '{printf "%-35s %25s\n",  $2,$4}'


列出 secgroup

[root@station140 ~(keystone_admin)]# nova secgroup-list
+--------------------------------------+---------+--------------------+
| Id                                   | Name    | Description        |
+--------------------------------------+---------+--------------------+
| 91a191a6-b89e-4f87-99c0-0fb985985978 | default | default            |
| 6966a8e4-0980-40ad-a409-baac65b60287 | terry   | allow ping and ssh |
+--------------------------------------+---------+--------------------+


列出可用网络

[root@hh-yun-puppet-129021 ~(keystone_admin)]# neutron  net-list
+--------------------------------------+------------+------------------------------------------------------+
| id                                   | name       | subnets                                              |
+--------------------------------------+------------+------------------------------------------------------+
| 0007150e-b600-4ea6-841d-79261bf10af8 | QA_NET     | ecc5f5a4-1fd7-4428-9351-6809ada3ad08 10.199.160.0/19 |
| 1e984167-3d90-49c0-91ad-b3910326fa5b | OPS_NET    | c2844b96-c26b-483d-b7fe-c2c37ff75cec 10.199.134.0/24 |
| 2530bdb0-8910-47d8-bcd5-696325c0cf7e | DMZ5_NET   | 35267c69-b8f1-4e5f-9784-5d49db020944 10.199.52.0/24  |
| 36c8028c-3ddb-44fb-b232-8eed3ee1c357 | DMZ1_NET   | 6b70aad7-3547-4d8d-9ab6-d73d080db88f 10.199.48.0/24  |
| 56886b13-e1a5-4213-8456-3616875a6a45 | MOBILE_NET | b18f5475-d334-4726-9508-b161e5998aed 10.199.144.0/20 |
| 594a0802-d2df-4aa1-9b49-3a0c4caa55c0 | DMZ3_NET   | 1bda2357-268f-4683-b21b-d1f69da62a9b 10.199.50.0/24  |
| a46f6060-bfd2-44af-b90c-858ca62f19da | MGMT_NET   | 91f2dc9f-9500-4615-989f-0d1562ab3c02 10.199.132.0/24 |
| bd780fa9-33fb-4757-887c-c1821630a15b | DMZ4_NET   | af474d04-baa0-4410-ac6f-3d7d282b95d6 10.199.51.0/24  |
| c3a26318-9741-4067-bd29-49124ac40970 | DMZ6_NET   | 2ec35a77-db91-4a9b-9497-ae3bef74035e 10.199.53.0/24  |
| d107fe05-0fe9-4fea-9325-4cf2d0825101 | DEV_NET    | b0bd1964-ef05-4aec-a602-9dc6a97ef9fd 10.199.192.0/18 |
| db1786d1-b8c8-4d27-a4d1-6890d6162557 | QATOOL_NET | b986aeff-f3ba-4f18-9138-f39a6fef323d 10.199.133.0/24 |
| e302ca3a-dc19-4387-90ef-f5eb188e98cd | TEST_NET   | 1b2ea04c-060a-4f6e-a8d6-66754f90c530 10.199.64.0/22  |
| f49a7526-ccbc-4d65-8169-433d19733887 | DMZ2_NET   | d3c4da60-6ef1-4c1a-965a-036639ab62f1 10.199.49.0/24  |
+--------------------------------------+------------+------------------------------------------------------+

 

启动第一个实例 (只有一个网卡)

[root@hh-yun-puppet-129021 ~(keystone_admin)]#  nova boot --flavor 2core-2g --image Centos6.6_x86_64_1.12  --security-groups default --nic net-id=d107fe05-0fe9-4fea-9325-4cf2d0825101 terry.gz.vclound.com --availability_zone develop-zone
+--------------------------------------+--------------------------------------------------------------+
| Property                             | Value                                                        |
+--------------------------------------+--------------------------------------------------------------+
| OS-DCF:diskConfig                    | MANUAL                                                       |
| OS-EXT-AZ:availability_zone          | nova                                                         |
| OS-EXT-SRV-ATTR:host                 | -                                                            |
| OS-EXT-SRV-ATTR:hypervisor_hostname  | -                                                            |
| OS-EXT-SRV-ATTR:instance_name        | instance-00017faf                                            |
| OS-EXT-STS:power_state               | 0                                                            |
| OS-EXT-STS:task_state                | scheduling                                                   |
| OS-EXT-STS:vm_state                  | building                                                     |  <- 状态为创建中
| OS-SRV-USG:launched_at               | -                                                            |
| OS-SRV-USG:terminated_at             | -                                                            |
| accessIPv4                           |                                                              |
| accessIPv6                           |                                                              |
| adminPass                            | tNMSsUoA7vcy                                                 |  <- root 密码
| availability_zone                    | develop-zone                                                 |  <- 云主机将会被创建在 develop-zone 中
| config_drive                         |                                                              |
| created                              | 2016-03-14T07:40:44Z                                         |
| flavor                               | 2core-2g (43664714-1c93-4e7a-adbd-9e47a6a932fa)              |
| hostId                               |                                                              |
| id                                   | 7dcfee9a-9338-489b-a335-215b8441d67b                         |
| image                                | Centos6.6_x86_64_1.12 (2250a24b-c83d-4c6b-882f-87415a46ea83) |
| key_name                             | -                                                            |
| metadata                             | {}                                                           |
| name                                 | terry.gz.vclound.com                                         | <- 主机名
| os-extended-volumes:volumes_attached | []                                                           |
| progress                             | 0                                                            |
| security_groups                      | default                                                      |
| status                               | BUILD                                                        |
| tenant_id                            | bb0b51d166254dc99bc7462c0ac002ff                             | <- 云主机 uuid
| updated                              | 2016-03-14T07:40:44Z                                         |
| user_id                              | 226e71f1c1aa4bae85485d1d17b6f0ae                             |
+--------------------------------------+--------------------------------------------------------------+


查询明细信息

[root@hh-yun-puppet-129021 ~(keystone_admin)]# nova show 486c00a7-e7f8-4bc5-b346-4bef8510832a
+--------------------------------------+--------------------------------------------------------------+
| Property                             | Value                                                        |
+--------------------------------------+--------------------------------------------------------------+
| DEV_NET network                      | 10.199.198.167                                               |  <- 云主机 ip 地址
| OS-DCF:diskConfig                    | MANUAL                                                       |
| OS-EXT-AZ:availability_zone          | develop-zone                                                 |
| OS-EXT-SRV-ATTR:host                 | hh-yun-compute-130238.vclound.com                            |
| OS-EXT-SRV-ATTR:hypervisor_hostname  | hh-yun-compute-130238.vclound.com                            |  <- 物理机
| OS-EXT-SRV-ATTR:instance_name        | instance-00017fa5                                            |
| OS-EXT-STS:power_state               | 0                                                            |
| OS-EXT-STS:task_state                | spawning                                                     |  
| OS-EXT-STS:vm_state                  | building                                                     |  <- 云主机状态
| OS-SRV-USG:launched_at               | -                                                            |
| OS-SRV-USG:terminated_at             | -                                                            |
| accessIPv4                           |                                                              |
| accessIPv6                           |                                                              |
| availability_zone                    | develop-zone                                                 |  <- zone
| config_drive                         |                                                              |
| created                              | 2016-03-14T04:56:10Z                                         |
| flavor                               | 2core-2g (43664714-1c93-4e7a-adbd-9e47a6a932fa)              |
| hostId                               | c522176438f370bc97e823844364a051949cd49e22f86832ca6768f6     |  <- 云主机 uuid
| id                                   | 486c00a7-e7f8-4bc5-b346-4bef8510832a                         |
| image                                | Centos6.6_x86_64_1.12 (2250a24b-c83d-4c6b-882f-87415a46ea83) |  <- images
| key_name                             | -                                                            |
| metadata                             | {}                                                           |
| name                                 | terry.gz.vclound.com                                         |  <- 主机名
| os-extended-volumes:volumes_attached | []                                                           |
| progress                             | 0                                                            |
| security_groups                      | default                                                      |
| status                               | BUILD                                                        |
| tenant_id                            | bb0b51d166254dc99bc7462c0ac002ff                             |
| updated                              | 2016-03-14T04:56:21Z                                         |
| user_id                              | 226e71f1c1aa4bae85485d1d17b6f0ae                             |
+--------------------------------------+--------------------------------------------------------------+

下面显示为正常运行中的 instance

[root@hh-yun-puppet-129021 ~(keystone_admin)]# nova list --name terry.gz.vclound.com
+--------------------------------------+----------------------+--------+------------+-------------+------------------------+
| ID                                   | Name                 | Status | Task State | Power State | Networks               |
+--------------------------------------+----------------------+--------+------------+-------------+------------------------+
| 486c00a7-e7f8-4bc5-b346-4bef8510832a | terry.gz.vclound.com | ACTIVE | -          | Running     | DEV_NET=10.199.198.167 |
+--------------------------------------+----------------------+--------+------------+-------------+------------------------+ 

列出主机部分信息

[root@hh-yun-puppet-129021 ~(keystone_admin)]# nova list  --fields "networks,name,status" --name terry.gz.vclound.com
+--------------------------------------+------------------------+----------------------+--------+
| ID                                   | Networks               | Name                 | Status |
+--------------------------------------+------------------------+----------------------+--------+
| 486c00a7-e7f8-4bc5-b346-4bef8510832a | DEV_NET=10.199.198.167 | terry.gz.vclound.com | ACTIVE |
+--------------------------------------+------------------------+----------------------+--------+


注: fields 需使用小写进行定义


关闭主机

[root@hh-yun-puppet-129021 ~(keystone_admin)]# nova stop 486c00a7-e7f8-4bc5-b346-4bef8510832a

[root@hh-yun-puppet-129021 ~(keystone_admin)]# nova list  --fields "networks,name,status" --name terry.gz.vclound.com
+--------------------------------------+------------------------+----------------------+---------+
| ID                                   | Networks               | Name                 | Status  |
+--------------------------------------+------------------------+----------------------+---------+
| 486c00a7-e7f8-4bc5-b346-4bef8510832a | DEV_NET=10.199.198.167 | terry.gz.vclound.com | SHUTOFF |
+--------------------------------------+------------------------+----------------------+---------+

删除主机

[root@hh-yun-puppet-129021 ~(keystone_admin)]# nova delete 486c00a7-e7f8-4bc5-b346-4bef8510832a

[root@hh-yun-puppet-129021 ~(keystone_admin)]# nova list  --fields "networks,name,status" --name terry.gz.vclound.com
+----+----------+------+--------+
| ID | Networks | Name | Status |
+----+----------+------+--------+
+----+----------+------+--------+

冷迁移主机或者改变主机 flavor 方法

列出 flavor

[root@hh-yun-puppet-129021 ~(keystone_admin)]# nova flavor-list
+--------------------------------------+-----------------+-----------+------+-----------+------+-------+-------------+-----------+
| ID                                   | Name            | Memory_MB | Disk | Ephemeral | Swap | VCPUs | RXTX_Factor | Is_Public |
+--------------------------------------+-----------------+-----------+------+-----------+------+-------+-------------+-----------+
| 05a60192-4e43-40ae-a2c7-d37d7e9a81b1 | 2core-8g-40g    | 8192      | 40   | 0         | 2048 | 2     | 1.0         | True      |
| 1012                                 | normal_1core    | 2048      | 20   | 0         | 1024 | 1     | 1.0         | False     |
| 12266e3a-a1fc-4f6a-83f8-fc841abce59e | b2c_allinone_8G | 8192      | 40   | 0         | 1024 | 4     | 1.0         | True      |
| 3017f87a-a3b2-46ef-8d37-ad341919b74c | 8core-8g        | 8192      | 40   | 0         | 2048 | 8     | 1.0         | True      |
| 43664714-1c93-4e7a-adbd-9e47a6a932fa | 2core-2g        | 2048      | 20   | 0         | 1024 | 2     | 1.0         | True      |
| 5c88939b-8807-4821-9718-5bafecc1daa2 | 2core-8g        | 8192      | 20   | 0         | 2048 | 2     | 1.0         | True      |
| 76269352-5050-4095-b4f3-3ea86cb2879c | 2core-2g-40g    | 2048      | 40   | 0         | 2048 | 2     | 1.0         | True      |
| 8d20b341-d0a2-47e2-acf7-73e64d76a8fe | 4core-8g        | 8192      | 40   | 0         | 2048 | 4     | 1.0         | True      |
| 989f6219-3231-45b5-bcfd-daf87ac07705 | 8core-16g       | 16384     | 40   | 0         | 2048 | 8     | 1.0         | True      |
| 9bb5f019-0c7c-41fc-a3ed-e6e44413a3d3 | 8core-32g       | 32768     | 40   | 0         | 2048 | 8     | 1.0         | True      |
| a009164a-f9fe-47fc-9876-e27dbcef1040 | mysql_db        | 4096      | 20   | 0         | 1024 | 4     | 1.0         | True      |
| bfaefcff-f01b-42fc-bdec-1e5c9fa3c0a1 | b2c_allinone    | 4096      | 40   | 0         | 1024 | 2     | 1.0         | True      |
| ced08277-a79f-491f-97eb-275d5271777e | b2c_web         | 2048      | 20   | 0         | 1024 | 2     | 1.0         | True      |
| dc98e6d6-143f-42c2-9482-ee6efb04ff7e | 4core-4g        | 4096      | 40   | 0         | 1024 | 4     | 1.0         | True      |
| de61ffb3-b1fe-46ec-99c5-390e5280e6d7 | 4core-16g       | 16384     | 40   | 0         | 2048 | 4     | 1.0         | True      |
| edd174c2-7ce1-445d-86b0-3d10705a12b1 | 2core-4g        | 4096      | 20   | 0         | 1024 | 2     | 1.0         | True      |
| f43fe47d-0be6-4c8f-ba0e-cdfa8fea04e0 | b2c_web_1core   | 2048      | 20   | 0         | 1024 | 1     | 1.0         | True      |
| ff40b4a3-fd79-444b-884b-6447e5dc3265 | 2core-4g-40g    | 4096      | 40   | 0         | 2048 | 2     | 1.0         | True      |
+--------------------------------------+-----------------+-----------+------+-----------+------+-------+-------------+-----------+


参考主机当前状态

[root@hh-yun-puppet-129021 ~(keystone_admin)]# nova show 7dcfee9a-9338-489b-a335-215b8441d67b | grep -E 'hypervisor_hostname|vm_state|flavor|task_state'
| OS-EXT-SRV-ATTR:hypervisor_hostname  | hh-yun-compute-130238.vclound.com                            |
| OS-EXT-STS:task_state                | -                                                            |
| OS-EXT-STS:vm_state                  | active                                                       |
| flavor                               | 2core-2g (43664714-1c93-4e7a-adbd-9e47a6a932fa)              |

当前云主机在物理机 hh-yun-compute-130238 上创建,  处于开机状态,  当前使用了 b2c_web_1core 的主机类型,

迁移, 重定义 flavor

nova resize 7dcfee9a-9338-489b-a335-215b8441d67b b2c_allinone

再次查询主机状态

[root@hh-yun-puppet-129021 ~(keystone_admin)]# nova show 7dcfee9a-9338-489b-a335-215b8441d67b | grep -E 'hypervisor_hostname|vm_state|flavor|task_state'
| OS-EXT-SRV-ATTR:hypervisor_hostname  | hh-yun-compute-130238.vclound.com                            |
| OS-EXT-STS:task_state                | resize_migrating                                             |
| OS-EXT-STS:vm_state                  | active                                                       |
| flavor                               | 2core-2g (43664714-1c93-4e7a-adbd-9e47a6a932fa)              |
当前主机处于 resize_migrating 状态


待完成迁移后, 再次查询状态

[root@hh-yun-puppet-129021 ~(keystone_admin)]# nova show 7dcfee9a-9338-489b-a335-215b8441d67b | grep -E 'hypervisor_hostname|vm_state|flavor|task_state'
| OS-EXT-SRV-ATTR:hypervisor_hostname  | hh-yun-compute-130214.vclound.com                            |
| OS-EXT-STS:task_state                | -                                                            |
| OS-EXT-STS:vm_state                  | active                                                       |
| flavor                               | 2core-4g (edd174c2-7ce1-445d-86b0-3d10705a12b1)              |

可见, 主机 flavor 已经发生改变, 另外, 云主机已经被迁移到  hh-yun-compute-130214 主机上,
目录
相关文章
|
存储 负载均衡 监控
金鱼哥RHCA回忆录:CL210管理OPENSTACK网络--开放虚拟网络(OVN)简介
第六章 管理OPENSTACK网络--开放虚拟网络(OVN)简介
1440 0
金鱼哥RHCA回忆录:CL210管理OPENSTACK网络--开放虚拟网络(OVN)简介
在openstack云平台中,使用命令行创建云主机操作步骤
在openstack云平台中,使用命令行创建云主机操作步骤
519 0
在openstack云平台中,使用命令行创建云主机操作步骤
|
运维 网络协议 测试技术
金鱼哥RHCA回忆录:CL210管理OPENSTACK网络--网络配置选项+章节实验
第六章 管理OPENSTACK网络--网络配置选项+章节实验
523 1
金鱼哥RHCA回忆录:CL210管理OPENSTACK网络--网络配置选项+章节实验
|
Linux
【openstack】命令行模式创建虚拟机
【openstack】命令行模式创建虚拟机
709 0
【openstack】命令行模式创建虚拟机
|
存储 网络协议 安全
金鱼哥RHCA回忆录:CL210管理OPENSTACK网络--网络协议类型
第六章 管理OPENSTACK网络--网络协议类型
391 0
金鱼哥RHCA回忆录:CL210管理OPENSTACK网络--网络协议类型
|
Linux 网络安全 KVM
[官版翻译ing]OpenStack云计算快速入门之三:OpenStack镜像管理
第三部分 OpenStack镜像管理 一、简介 很多源都有为OpenStack已经编译好的各种镜像了,您可以直接下载并通过使用这些镜像来熟悉OpenStack。 不过如果是为生产环境进行部署的话,您一定需要构建含有定制软件或配置的镜像文件。
1369 0
|
网络协议 Linux 网络安全
openstack 云平台一体化部署(超详细)
openstack 云平台一体化部署(超详细)
1024 0
openstack 云平台一体化部署(超详细)