首页 文章 精选 留言 我的

精选列表

搜索[命令行界面],共10000篇文章
优秀的个人博客,低调大师

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 | 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 主机上,

优秀的个人博客,低调大师

openstack 命令行管理十九 - 日志管理 (备忘)

instance 终端以日志方式输出方法 [root@station140 ~(network_admin)]# nova console-log --length 80 terry_instance1 | tail Starting atd: [ OK ][ OK ] Starting yum-updatesd: [ OK ] Failed to retrieve hostname from instance metadata. This is a soft error so we'll continue Failed to retrieve user-data from instance metadata. This is a soft error so we'll continue Starting smartd: [ OK ] CentOS release 5.8 (Final) Kernel 2.6.18-308.el5 on an x86_64 host-10-0-0-50 login:

优秀的个人博客,低调大师

openstack 命令行管理六 - 用户管理 (备忘)

openstack 中, 常见用户管理命令是 keystone 常见的管理是, 增加, 删除, 修改用户, 为用户设定角色 默认时候, 增加用户时都需要为用户指定一个租户, 我们同样介绍如何把用户加入到另外的一个租户中去 帮助 [root@station140 ~(keystone_admin)]# keystone | grep user [--os-username <auth-user-name>] Create EC2-compatible credentials for user per tenant. List EC2-compatible credentials for a user token-get Display the current user token. user-create Create new user user-delete Delete user user-get Display user details. user-list List users. user-password-update Update user password. user-role-add Add role to user user-role-list List roles granted to a user user-role-remove Remove role from user user-update Update user's name, email, and enabled status. bootstrap Grants a new role to a new user on a new tenant, after --os-username <auth-user-name> one via authentication (e.g. with username & 添加用户方法 [root@station140 ~(keystone_admin)]# keystone user-create --name terry --tenant cloud --pass vipshop --email <a target=_blank target="_blank" href="mailto:signmem@hotmail.com">signmem@hotmail.com</a> --enabled true +----------+----------------------------------+ | Property | Value | +----------+----------------------------------+ | email | <a target=_blank target="_blank" href="mailto:signmem@hotmail.com">signmem@hotmail.com</a> | | enabled | True | | id | 8f6478593aa845b3b44eded4aade0f6f | | name | terry | | tenantId | 9467f30b8bba4770a06a687e4584636b | <- 对应 cloud 的 id +----------+----------------------------------+ 更新用户信息 keystone user-update --name terry --email terry@111.com terry keystone user-list 命令只能够列出所有用户 或使用参数指定属于某个 project 中的用户 [root@station140 ~(keystone_admin)]# keystone user-list --tenant cloud +----------------------------------+-------+---------+---------------+ | id | name | enabled | email | +----------------------------------+-------+---------+---------------+ | 8f6478593aa845b3b44eded4aade0f6f | terry | True | terry@111.com | +----------------------------------+-------+---------+---------------+ 默认状态下, openstack 对租户具有两种常见格式, 管理员与用户(admin, _member_) [root@hh-yun-puppet-129021 ~(keystone_admin)]# keystone role-list +----------------------------------+---------------+ | id | name | +----------------------------------+---------------+ | e46045f97c974133980771e64913d75b | ResellerAdmin | | 9fe2ff9ee4384b1894a90878d3e92bab | _member_ | | 301acc99e28c457f9b27087a1eb1ab0b | admin | +----------------------------------+---------------+ 上面 user-create 命令, 把用户添加到 tenant 中, 默认用户具有 member 角色, 可以通过命令令用户成为管理员 keystone user-role-add --user terry.zeng --role admin --tenant cloud 把用户添加到另外一个租户方法, (用户只能够使用自己所属租户中的资源) keystone user-role-add --user terry.zeng --role _member_ --tenant DEV 假如要查询其他用户在某个 tenant 下的角色方法 你首先需要知道该用户密码, 才可以以该用户身份去执行角色查询, 因此这个方式是不推荐的 修改用户密码方法 [root@hh-yun-puppet-129021 ~(keystone_admin)]# keystone user-password-update terry.zeng New Password: Repeat New Password: 查询用户 terry.zeng 在 tenant QA 中的角色方法如下 [root@hh-yun-puppet-129021 ~(keystone_admin)]# keystone --os-username terry.zeng --os-password 123123 --os-tenant-name QA user-role-list +----------------------------------+----------+----------------------------------+----------------------------------+ | id | name | user_id | tenant_id | +----------------------------------+----------+----------------------------------+----------------------------------+ | 9fe2ff9ee4384b1894a90878d3e92bab | _member_ | 62b3813eb92e415b85816722e9479636 | 98e5fdd9e50f423881f49c845e1d26ad | | 301acc99e28c457f9b27087a1eb1ab0b | admin | 62b3813eb92e415b85816722e9479636 | 98e5fdd9e50f423881f49c845e1d26ad | +----------------------------------+----------+----------------------------------+----------------------------------+ 另外一个方法, 可以通过直接查询数据库获得 mysql> select a.name username, b.name tenant, c.name role from keystone.user a, keystone.project b, keystone.role c, keystone.assignment d where a.id = d.actor_id and b.id = d.target_id and c.id = d.role_id and a.name='terry.zeng' order by tenant; +------------+--------+----------+ | username | tenant | role | +------------+--------+----------+ | terry.zeng | DEV | _member_ | | terry.zeng | DEV | admin | | terry.zeng | DMZ1 | _member_ | | terry.zeng | DMZ1 | admin | | terry.zeng | DMZ2 | admin | | terry.zeng | DMZ2 | _member_ | | terry.zeng | MGMT | _member_ | | terry.zeng | MGMT | admin | | terry.zeng | MOBILE | _member_ | | terry.zeng | MOBILE | admin | | terry.zeng | OPS | _member_ | | terry.zeng | QA | admin | | terry.zeng | QA | _member_ | | terry.zeng | QATOOL | admin | | terry.zeng | QATOOL | _member_ | +------------+--------+----------+ 15 rows in set (0.01 sec)

优秀的个人博客,低调大师

openstack 命令行管理十四 - 路由管理 (备忘)

 帮助 [root@station140 ~(network_admin)]# neutron help | grep route l3-agent-list-hosting-router List L3 agents hosting a router. l3-agent-router-add Add a router to a L3 agent. l3-agent-router-remove Remove a router from a L3 agent. net-gateway-connect Add an internal network interface to a router. router-create Create a router for a given tenant. router-delete Delete a given router. router-gateway-clear Remove an external network gateway from a router. router-gateway-set Set the external network gateway for a router. router-interface-add Add an internal network interface to a router. router-interface-delete Remove an internal network interface from a router. router-list List routers that belong to a given tenant. router-list-on-l3-agent List the routers on a L3 agent. router-port-list List ports that belong to a given tenant, with specified router. router-show Show information of a given router. router-update Update router's information. 查询 tenant [root@station140 ~(network_admin)]# keystone tenant-list +----------------------------------+----------+---------+ | id | name | enabled | +----------------------------------+----------+---------+ | 9467f30b8bba4770a06a687e4584636b | cloud | True | +----------------------------------+----------+---------+ 创建路由连接到外部网络, 这个路由可以与内部网络进行连接 你可以创建过程中指定一个 tenant, 利用参数 --tenant-id 9467f30b8bba4770a06a687e4584636b 进行定义 创建路由 neutron router-create ext-to-int --tenant-id 9467f30b8bba4770a06a687e4584636b Created a new router: +-----------------------+--------------------------------------+ | Field | Value | +-----------------------+--------------------------------------+ | admin_state_up | True | | external_gateway_info | | | id | b83f43cd-bf8f-42f8-812a-708c2c372820 | | name | ext-to-int | | status | ACTIVE | | tenant_id | 9467f30b8bba4770a06a687e4584636b | +-----------------------+--------------------------------------+ 查询方法 [root@station140 ~(keystone_admin)]# neutron router-list | grep -v router1 +--------------------------------------+------------+------------------------+ | id | name | external_gateway_info | +--------------------------------------+------------+------------------------+ | b83f43cd-bf8f-42f8-812a-708c2c372820 | ext-to-int | null | +--------------------------------------+------------+------------------------+ 查询外部网络 [root@station140 ~(keystone_admin)]# neutron net-list | grep pub1 +--------------------------------------+---------+------------------------------------------------------+ | id | name | subnets | +--------------------------------------+---------+------------------------------------------------------+ | aebe75f0-6013-4a5e-bbd9-cb81e1f017bc | pub1 | 59cc431b-498e-49a0-bc60-4a8ca1ca6f48 192.168.48.0/24 | +--------------------------------------+---------+------------------------------------------------------+ 连接路由到外部网络, 设定外部网络网关 # neutron router-gateway-set b83f43cd-bf8f-42f8-812a-708c2c372820 aebe75f0-6013-4a5e-bbd9-cb81e1f017bc [root@station140 ~(keystone_admin)]# neutron router-list | grep -v router1 +--------------------------------------+------------+-----------------------------------------------------------------------------+ | id | name | external_gateway_info | +--------------------------------------+------------+-----------------------------------------------------------------------------+ | b83f43cd-bf8f-42f8-812a-708c2c372820 | ext-to-int | {"network_id": "aebe75f0-6013-4a5e-bbd9-cb81e1f017bc", "enable_snat": true} | +--------------------------------------+------------+-----------------------------------------------------------------------------+ 列出子网信息 [root@station140 ~(keystone_admin)]# neutron subnet-list | grep terry +--------------------------------------+----------------+-----------------+------------------------------------------------------+ | id | name | cidr | allocation_pools | +--------------------------------------+----------------+-----------------+------------------------------------------------------+ | 3066c397-bccf-4473-8a94-72b09a97a70a | terry_pri_net1 | 10.0.0.0/8 | {"start": "10.0.0.50", "end": "10.0.0.100"} | | 59cc431b-498e-49a0-bc60-4a8ca1ca6f48 | terry_pub_net1 | 192.168.48.0/24 | {"start": "192.168.48.142", "end": "192.168.48.148"} | +--------------------------------------+----------------+-----------------+------------------------------------------------------+ 创建内部网络路由接口 [root@station140 ~(network_admin)]# neutron router-interface-add b83f43cd-bf8f-42f8-812a-708c2c372820 3066c397-bccf-4473-8a94-72b09a97a70a Added interface c9566299-44ed-4924-b845-4fc48bd4de98bbfe84a2-508e-47a1-a664-27b2e8121893 to router b83f43cd-bf8f-42f8-812a-708c2c372820. 显示路由信息 [root@station140 ~(keystone_admin)]# neutron router-show b83f43cd-bf8f-42f8-812a-708c2c372820 +-----------------------+-----------------------------------------------------------------------------+ | Field | Value | +-----------------------+-----------------------------------------------------------------------------+ | admin_state_up | True | | external_gateway_info | {"network_id": "aebe75f0-6013-4a5e-bbd9-cb81e1f017bc", "enable_snat": true} | | id | b83f43cd-bf8f-42f8-812a-708c2c372820 | | name | ext-to-int | | routes | | | status | ACTIVE | | tenant_id | 9467f30b8bba4770a06a687e4584636b | +-----------------------+-----------------------------------------------------------------------------+ 移除路由接口 (interface) [root@station140 ~(keystone_admin)]# neutron router-interface-delete b83f43cd-bf8f-42f8-812a-708c2c372820 3066c397-bccf-4473-8a94-72b09a97a70a Removed interface from router b83f43cd-bf8f-42f8-812a-708c2c372820 移除路由的默认网关 查询 [root@station140 ~(keystone_admin)]# neutron router-list | grep network | grep ext-to-int +--------------------------------------+------------+-----------------------------------------------------------------------------+ | id | name | external_gateway_info | +--------------------------------------+------------+-----------------------------------------------------------------------------+ | b83f43cd-bf8f-42f8-812a-708c2c372820 | ext-to-int | {"network_id": "aebe75f0-6013-4a5e-bbd9-cb81e1f017bc", "enable_snat": true} | +--------------------------------------+------------+-----------------------------------------------------------------------------+ 当 external_gateway_info 则表示具有默认网关 删除网关接口 [root@station140 ~(keystone_admin)]# neutron router-gateway-clear b83f43cd-bf8f-42f8-812a-708c2c372820 Removed gateway from router b83f43cd-bf8f-42f8-812a-708c2c372820 下面显示为不具备网关的路由 [root@station140 ~(keystone_admin)]# neutron router-list | grep ext-to-int +--------------------------------------+------------+-----------------------+ | id | name | external_gateway_info | +--------------------------------------+------------+-----------------------+ | b83f43cd-bf8f-42f8-812a-708c2c372820 | ext-to-int | null | +--------------------------------------+------------+-----------------------+ 删除路由 [root@station140 ~(keystone_admin)]# neutron router-delete b83f43cd-bf8f-42f8-812a-708c2c372820 Deleted router: b83f43cd-bf8f-42f8-812a-708c2c372820

优秀的个人博客,低调大师

openstack 命令行管理十六 - 网络测试 (备忘)

 注: 192.168.48.142 为 floating ip ping 测试 [root@station140 ~(keystone_admin)]# ping 192.168.48.142 PING 192.168.48.142 (192.168.48.142) 56(84) bytes of data. 64 bytes from 192.168.48.142: icmp_seq=1 ttl=63 time=1.61 ms ssh 测试 [root@station140 ~(keystone_admin)]# ssh 192.168.48.142 The authenticity of host '192.168.48.142 (192.168.48.142)' can't be established. RSA key fingerprint is 7f:cc:6e:22:e4:39:99:6a:4c:de:4a:82:df:e9:1c:6c. Are you sure you want to continue connecting (yes/no)? ip netns 空间测试方法 查询路由方法 [root@station140 ~(keystone_admin)]# neutron router-list | grep -v router1 +--------------------------------------+------------+-----------------------------------------------------------------------------+ | id | name | external_gateway_info | +--------------------------------------+------------+-----------------------------------------------------------------------------+ | b83f43cd-bf8f-42f8-812a-708c2c372820 | ext-to-int | {"network_id": "aebe75f0-6013-4a5e-bbd9-cb81e1f017bc", "enable_snat": true} | +--------------------------------------+------------+-----------------------------------------------------------------------------+ 列出网络命名空间 [root@station140 ~(keystone_admin)]# ip netns qrouter-59fa152c-df2e-43e4-9d09-7b89fb9cce5d qdhcp-dc121f2d-1b3b-471f-8fe7-15ef973b949e qrouter-99859660-68fe-4be4-835a-073a05da6533 qrouter-b83f43cd-bf8f-42f8-812a-708c2c372820 qdhcp-d0e3f988-d62f-4f95-ab21-b73f4dae326b qdhcp-e8e14001-44d9-4ab1-a462-ea621b8a4746 利用网络命名空间进行操作例 1 [root@station140 ~(keystone_admin)]# ip netns exec qrouter-b83f43cd-bf8f-42f8-812a-708c2c372820 ip addr list 32: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo inet6 ::1/128 scope host valid_lft forever preferred_lft forever 33: qg-5a8b8f30-f5: <BROADCAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN link/ether fa:16:3e:6f:b7:1c brd ff:ff:ff:ff:ff:ff inet 192.168.48.143/24 brd 192.168.48.255 scope global qg-5a8b8f30-f5 inet 192.168.48.142/32 brd 192.168.48.142 scope global qg-5a8b8f30-f5 inet6 fe80::f816:3eff:fe6f:b71c/64 scope link valid_lft forever preferred_lft forever 34: qr-bbfe84a2-50: <BROADCAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN link/ether fa:16:3e:1c:fd:1e brd ff:ff:ff:ff:ff:ff inet 10.0.0.1/8 brd 10.255.255.255 scope global qr-bbfe84a2-50 inet6 fe80::f816:3eff:fe1c:fd1e/64 scope link valid_lft forever preferred_lft forever 利用网络命名空间进行操作例 2 [root@station140 ~(keystone_admin)]# ip netns exec qrouter-b83f43cd-bf8f-42f8-812a-708c2c372820 ping 192.168.48.142 PING 192.168.48.142 (192.168.48.142) 56(84) bytes of data. 64 bytes from 192.168.48.142: icmp_seq=1 ttl=64 time=2.01 ms ^C --- 192.168.48.142 ping statistics --- 1 packets transmitted, 1 received, 0% packet loss, time 615ms rtt min/avg/max/mdev = 2.013/2.013/2.013/0.000 ms 利用网络命名空间进行操作例 3 [root@station140 ~(keystone_admin)]# ip netns exec qrouter-b83f43cd-bf8f-42f8-812a-708c2c372820 ping 10.0.0.50 PING 10.0.0.50 (10.0.0.50) 56(84) bytes of data. 64 bytes from 10.0.0.50: icmp_seq=1 ttl=64 time=2.27 ms

优秀的个人博客,低调大师

openstack 命令行管理八 - 服务管理 (备忘)

 帮助 [root@station140 tmp(keystone_admin)]# keystone help | grep service service-create Add service to Service Catalog. service-delete Delete service from Service Catalog. service-get Display service from Service Catalog. service-list List all services in Service Catalog. 列出当前的服务方法 [root@station140 tmp(keystone_admin)]# keystone service-list +----------------------------------+------------+--------------+--------------------------------+ | id | name | type | description | +----------------------------------+------------+--------------+--------------------------------+ | 4db88c4e3efe4f188b6f08756d28c407 | ceilometer | metering | Openstack Metering Service | | e4ce5457b38e4a50a929af9b2b02b81c | cinder | volume | Cinder Service | | ab1e6db2a7b54a459f928075263a8b0f | cinder_v2 | volumev2 | Cinder Service v2 | | f025dc6a95db40f586b6975b154465b9 | glance | image | Openstack Image Service | | 04a34fae776c4573a4d26ccca9407ec9 | keystone | identity | OpenStack Identity Service | | 39f89e436d4942a1b2349e02cfddbed2 | neutron | network | Neutron Networking Service | | 60796518d55347f981ce319121c5e6bf | nova | compute | Openstack Compute Service | | 7867dcf1ec1647efa2287344c2f00775 | nova_ec2 | ec2 | EC2 Service | | 743203738a074f5bac198be5e52977d8 | swift | object-store | Openstack Object-Store Service | | 8b7b18fc6b7c4f169b10282252c0571c | swift_s3 | s3 | Openstack S3 Service | +----------------------------------+------------+--------------+--------------------------------+ 服务管理帮助 [root@station140 tmp(keystone_admin)]# nova help | grep service [--service-type <service-type>] [--service-name <service-name>] [--volume-service-name <volume-service-name>] authenticate services. host-list List all hosts by service. service-disable Disable the service. service-enable Enable the service. service-list Show a list of all running services. Filter by host & --service-type <service-type> --service-name <service-name> --volume-service-name <volume-service-name> 列出 openstack 当前可用的服务器 [root@station140 tmp(keystone_admin)]# nova host-list +----------------------+-------------+----------+ | host_name | service | zone | +----------------------+-------------+----------+ | station140.cloud.com | consoleauth | internal | | station140.cloud.com | scheduler | internal | | station140.cloud.com | conductor | internal | | station140.cloud.com | compute | nova | | station140.cloud.com | cert | internal | +----------------------+-------------+----------+注: 当前使用 all in one 模式, 所以只返回一个 host_name 结果 列出主机上的服务状态 [root@station140 tmp(keystone_admin)]# nova service-list +------------------+----------------------+----------+---------+-------+----------------------------+-----------------+ | Binary | Host | Zone | Status | State | Updated_at | Disabled Reason | +------------------+----------------------+----------+---------+-------+----------------------------+-----------------+ | nova-consoleauth | station140.cloud.com | internal | enabled | up | 2014-02-14T08:40:37.000000 | None | | nova-scheduler | station140.cloud.com | internal | enabled | up | 2014-02-14T08:40:37.000000 | None | | nova-conductor | station140.cloud.com | internal | enabled | up | 2014-02-14T08:40:38.000000 | None | | nova-compute | station140.cloud.com | nova | enabled | up | 2014-02-14T08:40:29.000000 | None | | nova-cert | station140.cloud.com | internal | enabled | up | 2014-02-14T08:40:33.000000 | None | +------------------+----------------------+----------+---------+-------+----------------------------+-----------------+ 关闭某个服务: nova service-disable localhost.localdomain nova-compute --reason 'trial log' <- just test 重新启动服务 nova service-enable localhost.localdomain nova-compute

优秀的个人博客,低调大师

openstack 命令行管理七 - 角色管理 (备忘)

 帮助 [root@station140 ~(keystone_admin)]# keystone help | grep role role-create Create new role. role-delete Delete role. role-get Display role details. role-list List all roles. user-role-add Add role to user user-role-list List roles granted to a user user-role-remove Remove role from user bootstrap Grants a new role to a new user on a new tenant, after 创建方法 [root@station140 ~(keystone_admin)]# keystone role-create --name vgroup +----------+----------------------------------+ | Property | Value | +----------+----------------------------------+ | id | 9ea4fb60241c4a12b3c89630cf3f087a | | name | vgroup | +----------+----------------------------------+ 把用户添加到某个角色中方法 [root@station140 ~(keystone_admin)]# keystone user-role-add --user terry --role vgroup --tenant cloud 显示角色中的用户方法 [root@station140 ~(keystone_admin)]# keystone user-role-list --user terry --tenant cloud <- 必须的参数 +----------------------------------+----------+----------------------------------+----------------------------------+ | id | name | user_id | tenant_id | +----------------------------------+----------+----------------------------------+----------------------------------+ | 9fe2ff9ee4384b1894a90878d3e92bab | _member_ | 8f6478593aa845b3b44eded4aade0f6f | 9467f30b8bba4770a06a687e4584636b | | 9ea4fb60241c4a12b3c89630cf3f087a | vgroup | 8f6478593aa845b3b44eded4aade0f6f | 9467f30b8bba4770a06a687e4584636b | +----------------------------------+----------+----------------------------------+----------------------------------+ 移除角色中的某个用户 [root@station140 ~(keystone_admin)]# keystone user-role-remove --user terry --role vgroup --tenant cloud

优秀的个人博客,低调大师

openstack 命令行管理十 - 密钥管理 (备忘)

 帮助 [root@station140 ~(keystone_admin)]# nova help | grep key flavor-key Set or unset extra_spec for a flavor. keypair-add Create a new key pair for use with instances. 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. 创建密钥方法 [ 略 ] ssh-keygen 命令 (默认安装时候已经生成密钥) 添加密钥方法 [root@station140 ~(keystone_admin)]# nova keypair-add --pub-key /root/.ssh/id_rsa.pub terrykey 显示密钥方法 [root@station140 ~(keystone_admin)]# nova keypair-list +----------+-------------------------------------------------+ | Name | Fingerprint | +----------+-------------------------------------------------+ | terrykey | 94:b8:9c:2a:31:8c:2c:87:7f:f5:80:24:23:73:f8:e9 | +----------+-------------------------------------------------+ 密钥作用 当 instance 分配了浮动 IP 后, 允许 server 能够直接访问 instance 时候, 才可以利用密钥配对进行访问 假如通过 novnc 进行访问时候, 仍然需要通过 root/password 方法进行访问

优秀的个人博客,低调大师

openstack 命令行管理二 - 镜像管理 (备忘)

帮助 [root@station140 ~(keystone_admin)]# glance help | grep image [--os-image-url OS_IMAGE_URL] [-U OS_IMAGE_URL] [--os-image-api-version OS_IMAGE_API_VERSION] add DEPRECATED! Use image-create instead. delete DEPRECATED! Use image-delete instead. details DEPRECATED! Use image-list instead. image-create Create a new image. image-delete Delete specified image(s). image-download Download a specific image. image-list List images you can access. image-members DEPRECATED! Use member-list instead. image-show Describe a specific image. image-update Update a specific image. index DEPRECATED! Use image-list instead. member-create Share a specific image with a tenant. member-delete Remove a shared image from a tenant. member-images DEPRECATED! Use member-list instead. member-list Describe sharing permissions by image or tenant. show DEPRECATED! Use image-show instead. update DEPRECATED! Use image-update instead. 下载镜像或者自行创建 [ 略 ] 导入镜像方法 [root@localhost tmp]# source /root/keystonerc_admin [root@localhost tmp(keystone_admin)]# glance image-create --name centos5.8_x86_64 --disk-format=qcow2 --container-format=bare --is-public=True --file=/tmp/centos5.8_x86_64_growroot_1.2_20131231.qcow2 +------------------+--------------------------------------+ | Property | Value | +------------------+--------------------------------------+ | checksum | 06de52dfbc2f582115b0c1981c2e3568 | 当前文件 md5 checksum 码 | container_format | bare | | created_at | 2014-02-14T03:33:01 | 导入时间 | deleted | False | | deleted_at | None | | disk_format | qcow2 | 磁盘格式 | id | 2aad80bf-6fbb-4348-bb20-2c07dbf4f687 | 当前磁盘唯一 ID 值 | is_public | True | | min_disk | 0 | | min_ram | 0 | | name | centos5.8_x86_64 | | owner | e3a71a59840c4e88b8740b789c3afb9c | 当前 openstack owner | protected | False | | size | 1151598592 | | status | active | | updated_at | 2014-02-14T03:33:11 | +------------------+--------------------------------------+ 列出当前可用镜像 [root@station140 ~(keystone_admin)]# glance image-list +--------------------------------------+------------------+-------------+------------------+------------+--------+ | ID | Name | Disk Format | Container Format | Size | Status | +--------------------------------------+------------------+-------------+------------------+------------+--------+ | 2aad80bf-6fbb-4348-bb20-2c07dbf4f687 | centos5.8_x86_64 | qcow2 | bare | 1151598592 | active | | 2d6bb00d-002f-4675-ba84-73d90fdc1020 | cirros | qcow2 | bare | 13147648 | active | +--------------------------------------+------------------+-------------+------------------+------------+--------+ [root@station140 ~(keystone_admin)]# glance details ================================================================================ URI: http://192.168.48.140:9292/v1/images/2aad80bf-6fbb-4348-bb20-2c07dbf4f687 Id: 2aad80bf-6fbb-4348-bb20-2c07dbf4f687 Public: Yes Protected: No Name: centos5.8_x86_64 Status: active Size: 1151598592 Disk format: qcow2 Container format: bare Minimum Ram Required (MB): 0 Minimum Disk Required (GB): 0 Owner: e3a71a59840c4e88b8740b789c3afb9c Created at: 2014-02-14T03:33:01 Deleted at: None Updated at: 2014-02-14T03:33:11 ================================================================================ 查询某个镜像详细信息方法 glance image-show 0c47db9c-5f74-4544-8ada-0894c1d2c20c +------------------------+--------------------------------------+ | Property | Value | +------------------------+--------------------------------------+ | Property 'description' | Windows7#_# | | checksum | eaa3a3a6dfe605f6292675018d41afdf | | container_format | bare | | created_at | 2014-09-25T08:33:46 | | deleted | False | | disk_format | qcow2 | | id | 0c47db9c-5f74-4544-8ada-0894c1d2c20c | | is_public | True | | min_disk | 0 | | min_ram | 0 | | name | Win7 | | owner | 3bf7f92c8b1449a8814b1cf15e1d1cda | | protected | False | | size | 3547856896 | | status | active | | updated_at | 2015-06-12T05:24:54 | +------------------------+--------------------------------------+ 删除镜像 [root@station140 ~(keystone_admin)]# nova image-delete cirros 下载镜像 [root@station140~(keystone_admin)]# glance image-download--file /tmp/ centos5.8_x86_64.qcow2 2aad80bf-6fbb-4348-bb20-2c07dbf4f687 

优秀的个人博客,低调大师

openstack 命令行管理三 - tenant 管理 (备忘)

Openstack 中, 以租户作为云主机隔离的单位 project 等同于 tenant OpenStack Compute Service (nova) 作为认证时候, 称为 project OpenStack Identity Service (keystone) 作为认证时候, 称为 tenant 在管理 openstack 时候, 需要添加独立的 project, 然后每个 project 具有独立的用户, 网络, 云主机 添加用户前需要添加对应 project keystone 命令帮助 tenant-create Create new tenant. tenant-delete Delete tenant. tenant-get Display tenant details. tenant-list List all tenants. tenant-update Update tenant name, description, enabled status. bootstrap Grants a new role to a new user on a new tenant, after --os-tenant-name <auth-tenant-name> --os-tenant-id <tenant-id> 添加 tenant [root@station140 ~(keystone_admin)]# keystone tenant-create --name cloud +-------------+----------------------------------+ | Property | Value | +-------------+----------------------------------+ | description | | | enabled | True | | id | 9467f30b8bba4770a06a687e4584636b | <- 创建后, 使用 keystone tenant-get cloud 能够重新调回信息 | name | cloud | +-------------+----------------------------------+ 列出 tenant [root@station140 ~(keystone_admin)]# keystone tenant-list +----------------------------------+----------+---------+ | id | name | enabled | +----------------------------------+----------+---------+ | e3a71a59840c4e88b8740b789c3afb9c | admin | True | | fa30a4cd2eba46f0b58d591b7335d660 | alt_demo | True | | 9467f30b8bba4770a06a687e4584636b | cloud | True | | 87c63116e3b4440eaa9640494b53cd43 | demo | True | | bc95edec7a674bb8873d067d9ddedaec | services | True | +----------------------------------+----------+---------+ 更新信息 [root@station140 ~(keystone_admin)]# keystone tenant-update --description="use for test." --enabled=true cloud [root@station140 ~(keystone_admin)]# keystone tenant-get cloud +-------------+----------------------------------+ | Property | Value | +-------------+----------------------------------+ | description | use for test. | | enabled | True | | id | 9467f30b8bba4770a06a687e4584636b | | name | cloud | +-------------+----------------------------------+ 删除 tenant keystone tenant-delete 9467f30b8bba4770a06a687e4584636b

资源下载

更多资源
Nacos

Nacos

Nacos /nɑ:kəʊs/ 是 Dynamic Naming and Configuration Service 的首字母简称,一个易于构建 AI Agent 应用的动态服务发现、配置管理和AI智能体管理平台。Nacos 致力于帮助您发现、配置和管理微服务及AI智能体应用。Nacos 提供了一组简单易用的特性集,帮助您快速实现动态服务发现、服务配置、服务元数据、流量管理。Nacos 帮助您更敏捷和容易地构建、交付和管理微服务平台。

Spring

Spring

Spring框架(Spring Framework)是由Rod Johnson于2002年提出的开源Java企业级应用框架,旨在通过使用JavaBean替代传统EJB实现方式降低企业级编程开发的复杂性。该框架基于简单性、可测试性和松耦合性设计理念,提供核心容器、应用上下文、数据访问集成等模块,支持整合Hibernate、Struts等第三方框架,其适用范围不仅限于服务器端开发,绝大多数Java应用均可从中受益。

Rocky Linux

Rocky Linux

Rocky Linux(中文名:洛基)是由Gregory Kurtzer于2020年12月发起的企业级Linux发行版,作为CentOS稳定版停止维护后与RHEL(Red Hat Enterprise Linux)完全兼容的开源替代方案,由社区拥有并管理,支持x86_64、aarch64等架构。其通过重新编译RHEL源代码提供长期稳定性,采用模块化包装和SELinux安全架构,默认包含GNOME桌面环境及XFS文件系统,支持十年生命周期更新。

Sublime Text

Sublime Text

Sublime Text具有漂亮的用户界面和强大的功能,例如代码缩略图,Python的插件,代码段等。还可自定义键绑定,菜单和工具栏。Sublime Text 的主要功能包括:拼写检查,书签,完整的 Python API , Goto 功能,即时项目切换,多选择,多窗口等等。Sublime Text 是一个跨平台的编辑器,同时支持Windows、Linux、Mac OS X等操作系统。

用户登录
用户注册