一、glance服务运维(镜像)
1、不会的可以需求帮助
[root@controller ~]# glance help image-create
usage: glance image-create [--architecture <ARCHITECTURE>]
[--protected [True|False]] [--name <NAME>]
[--instance-uuid <INSTANCE_UUID>]
[--min-disk <MIN_DISK>] [--visibility <VISIBILITY>]
[--kernel-id <KERNEL_ID>]
[--tags <TAGS> [<TAGS> ...]]
[--os-version <OS_VERSION>]
[--disk-format <DISK_FORMAT>]
[--os-distro <OS_DISTRO>] [--id <ID>]
[--owner <OWNER>] [--ramdisk-id <RAMDISK_ID>]
[--min-ram <MIN_RAM>]
[--container-format <CONTAINER_FORMAT>]
[--property <key=value>] [--file <FILE>]
[--progress]
Create a new image.
Optional arguments:
--architecture <ARCHITECTURE>
Operating system architecture as specified in
http://docs.openstack.org/trunk/openstack-
compute/admin/content/adding-images.html
--protected [True|False]
If true, image will not be deletable.
--name <NAME> Descriptive name for the image
--instance-uuid <INSTANCE_UUID>
Metadata which can be used to record which instance
this image is associated with. (Informational only,
does not create an instance snapshot.)
--min-disk <MIN_DISK>
Amount of disk space (in GB) required to boot image.
--visibility <VISIBILITY>
Scope of image accessibility Valid values: public,
private
--kernel-id <KERNEL_ID>
ID of image stored in Glance that should be used as
the kernel when booting an AMI-style image.
--tags <TAGS> [<TAGS> ...]
List of strings related to the image
--os-version <OS_VERSION>
Operating system version as specified by the
distributor
--disk-format <DISK_FORMAT>
Format of the disk Valid values: ami, ari, aki, vhd,
vmdk, raw, qcow2, vdi, iso
--os-distro <OS_DISTRO>
Common name of operating system distribution as
specified in http://docs.openstack.org/trunk
/openstack-compute/admin/content/adding-images.html
--id <ID> An identifier for the image
--owner <OWNER> Owner of the image
--ramdisk-id <RAMDISK_ID>
ID of image stored in Glance that should be used as
the ramdisk when booting an AMI-style image.
--min-ram <MIN_RAM> Amount of ram (in MB) required to boot image.
--container-format <CONTAINER_FORMAT>
Format of the container Valid values: ami, ari, aki,
bare, ovf, ova, docker
--property <key=value>
Arbitrary property to associate with image. May be
used multiple times.
--file <FILE> Local file that contains disk image to be uploaded
during creation. Alternatively, the image data can be
passed to the client via stdin.
--progress Show upload progress bar.
Run `glance --os-image-api-version 1 help image-create` for v1 help
[root@controller ~]#
2、上传镜像
[root@controller ~]# glance image-create --name "cirros" --disk-format qcow2 --container-format bare --progress< cirros-0.3.4-x86_64-disk.img
[=============================>] 100%
+------------------+--------------------------------------+
| Property | Value |
+------------------+--------------------------------------+
| checksum | ee1eca47dc88f4879d8a229cc70a07c6 |
| container_format | bare |
| created_at | 2020-11-20T08:55:29Z |
| disk_format | qcow2 |
| id | 3706ffb6-6668-4874-9eb3-879ad7c073ce |
| min_disk | 0 |
| min_ram | 0 |
| name | cirros |
| owner | c852297c681c4ba9afe144de7f4b9802 |
| protected | False |
| size | 13287936 |
| status | active |
| tags | [] |
| updated_at | 2020-11-20T08:55:30Z |
| virtual_size | None |
| visibility | private |
+------------------+--------------------------------------+
3、查看镜像列表
[root@controller ~]# glance image-list
+--------------------------------------+-----------+
| ID | Name |
+--------------------------------------+-----------+
| 5b5452c5-93bd-45ec-9807-5ba62c26bb73 | |
| f27ffb31-0ddd-4efa-90ab-ccc5d817a308 | centos7.2 |
| 0608ab3c-d15a-45cb-a6cf-454980f64a74 | cirros |
| 3706ffb6-6668-4874-9eb3-879ad7c073ce | cirros |
| 60c74d31-a365-43de-aa4c-6a9400bf7167 | cirros |
| c181f238-ef41-40a0-96a6-06b8b28cc8b2 | keyi |
+--------------------------------------+-----------+
4、查看镜像详情
show 后面跟名字或者ID,但重名的不能使用名称
[root@controller ~]# glance image-show cirros
404 Not Found: No image found with ID cirros (HTTP 404)
[root@controller ~]# glance image-show 60c74d31-a365-43de-aa4c-6a9400bf7167
+------------------+--------------------------------------+
| Property | Value |
+------------------+--------------------------------------+
| checksum | ee1eca47dc88f4879d8a229cc70a07c6 |
| container_format | bare |
| created_at | 2020-11-20T09:03:22Z |
| disk_format | qcow2 |
| id | 60c74d31-a365-43de-aa4c-6a9400bf7167 |
| min_disk | 0 |
| min_ram | 0 |
| name | cirros |
| owner | c852297c681c4ba9afe144de7f4b9802 |
| protected | False |
| size | 13287936 |
| status | active |
| tags | [] |
| updated_at | 2020-11-20T09:03:23Z |
| virtual_size | None |
| visibility | private |
+------------------+--------------------------------------+
5、删除镜像
[root@controller ~]# glance image-delete 60c74d31-a365-43de-aa4c-6a9400bf7167
[root@controller ~]# glance image-list
+--------------------------------------+-----------+
| ID | Name |
+--------------------------------------+-----------+
| 5b5452c5-93bd-45ec-9807-5ba62c26bb73 | |
| f27ffb31-0ddd-4efa-90ab-ccc5d817a308 | centos7.2 |
| 0608ab3c-d15a-45cb-a6cf-454980f64a74 | cirros |
| 3706ffb6-6668-4874-9eb3-879ad7c073ce | cirros |
| c181f238-ef41-40a0-96a6-06b8b28cc8b2 | keyi |
+--------------------------------------+-----------+
6、更新镜像信息
如果需要改变镜像启动硬盘最低要求值(min-disk)时,min-disk 默认单位为 G
(更新前的镜像信息)
[root@controller ~]# glance image-show c181f238-ef41-40a0-96a6-06b8b28cc8b2
+------------------+--------------------------------------+
| Property | Value |
+------------------+--------------------------------------+
| base_image_ref | 0608ab3c-d15a-45cb-a6cf-454980f64a74 |
| checksum | e82a60053417a73494231661ac5f4854 |
| container_format | bare |
| created_at | 2020-11-19T20:40:48Z |
| disk_format | qcow2 |
| id | c181f238-ef41-40a0-96a6-06b8b28cc8b2 |
| image_location | snapshot |
| image_state | available |
| image_type | snapshot |
| instance_uuid | 6405e300-e878-4d76-8bf4-3017d9552e77 |
| kernel_id | None |
| min_disk | 20 |
| min_ram | 0 |
| name | keyi |
| owner | c852297c681c4ba9afe144de7f4b9802 |
| owner_id | c852297c681c4ba9afe144de7f4b9802 |
| protected | False |
| ramdisk_id | None |
| size | 22151168 |
| status | active |
| tags | [] |
| updated_at | 2020-11-19T20:40:58Z |
| user_id | 4044a241e7b04403813e255f30d35a66 |
| virtual_size | None |
| visibility | private |
+------------------+--------------------------------------+
(更新镜像信息)
[root@controller ~]# glance image-update --min-disk 1 c181f238-ef41-40a0-96a6-06b8b28cc8b2
+------------------+--------------------------------------+
| Property | Value |
+------------------+--------------------------------------+
| base_image_ref | 0608ab3c-d15a-45cb-a6cf-454980f64a74 |
| checksum | e82a60053417a73494231661ac5f4854 |
| container_format | bare |
| created_at | 2020-11-19T20:40:48Z |
| disk_format | qcow2 |
| id | c181f238-ef41-40a0-96a6-06b8b28cc8b2 |
| image_location | snapshot |
| image_state | available |
| image_type | snapshot |
| instance_uuid | 6405e300-e878-4d76-8bf4-3017d9552e77 |
| kernel_id | None |
| min_disk | 1 |
| min_ram | 0 |
| name | keyi |
| owner | c852297c681c4ba9afe144de7f4b9802 |
| owner_id | c852297c681c4ba9afe144de7f4b9802 |
| protected | False |
| ramdisk_id | None |
| size | 22151168 |
| status | active |
| tags | [] |
| updated_at | 2020-11-20T09:24:53Z |
| user_id | 4044a241e7b04403813e255f30d35a66 |
| virtual_size | None |
| visibility | private |
+------------------+--------------------------------------+
二、Nova 服务运维(是 OpenStack 计算的弹性控制器)
1、Nova 管理安全组规则
创建安全组,test为创建的安全组的名称,后面的单引号里是对这个安全组的描述。
[root@controller ~]# nova secgroup-create test 'casual'
+--------------------------------------+------+-------------+
| Id | Name | Description |
+--------------------------------------+------+-------------+
| 02f71a3e-4571-4047-bbb3-d66a40418abe | test | casual |
+--------------------------------------+------+-------------+
2、Nova 管理虚拟机类型
通过help可以看到 这几项是必须写的
[root@controller ~]# nova help flavor-create
usage: nova flavor-create [--ephemeral <ephemeral>] [--swap <swap>]
[--rxtx-factor <factor>] [--is-public <is-public>]
<name> <id> <ram> <disk> <vcpus>
Create a new flavor.
Positional arguments:
<name> Unique name of the new flavor.
<id> Unique ID of the new flavor. Specifying 'auto' will
generated a UUID for the ID.
<ram> Memory size in MB.
<disk> Disk size in GB.
<vcpus> Number of vcpus
Optional arguments:
--ephemeral <ephemeral> Ephemeral space size in GB (default 0).
--swap <swap> Swap space size in MB (default 0).
--rxtx-factor <factor> RX/TX factor (default 1).
--is-public <is-public> Make flavor accessible to the public (default
true).
创建一个名为 test,ID 为 6,内存为 2048 MB,磁盘为 5 GB,vCPU 数量为2 的云主机类型。
[root@controller ~]# nova flavor-create test 6 2048 5 2
+----+------+-----------+------+-----------+------+-------+-------------+-----------+
| ID | Name | Memory_MB | Disk | Ephemeral | Swap | VCPUs | RXTX_Factor | Is_Public |
+----+------+-----------+------+-----------+------+-------+-------------+-----------+
| 6 | test | 2048 | 5 | 0 | | 2 | 1.0 | True |
+----+------+-----------+------+-----------+------+-------+-------------+-----------+
查看云主机类型列表
[root@controller ~]# nova flavor-list
+----+-----------+-----------+------+-----------+------+-------+-------------+-----------+
| ID | Name | Memory_MB | Disk | Ephemeral | Swap | VCPUs | RXTX_Factor | Is_Public |
+----+-----------+-----------+------+-----------+------+-------+-------------+-----------+
| 1 | m1.tiny | 512 | 1 | 0 | | 1 | 1.0 | True |
| 2 | m1.small | 2048 | 20 | 0 | | 1 | 1.0 | True |
| 3 | m1.medium | 4096 | 40 | 0 | | 2 | 1.0 | True |
| 4 | m1.large | 8192 | 80 | 0 | | 4 | 1.0 | True |
| 5 | m1.xlarge | 16384 | 160 | 0 | | 8 | 1.0 | True |
| 6 | test | 2048 | 5 | 0 | | 2 | 1.0 | True |
+----+-----------+-----------+------+-----------+------+-------+-------------+-----------+
查看test的详细信息
[root@controller ~]# nova flavor-show test
+----------------------------+-------+
| Property | Value |
+----------------------------+-------+
| OS-FLV-DISABLED:disabled | False |
| OS-FLV-EXT-DATA:ephemeral | 0 |
| disk | 5 |
| extra_specs | {} |
| id | 6 |
| name | test |
| os-flavor-access:is_public | True |
| ram | 2048 |
| rxtx_factor | 1.0 |
| swap | |
| vcpus | 2 |
+----------------------------+-------+
3、实例管理
启动实例
# nova boot
格式:
nova boot [--flavor <flavor>] [--image <image>]
删除实例
# nova delete
格式:
# nova delete [--all-tenants] <server> [<server> ...]
查看nova服务
[root@controller ~]# nova service-list
+----+------------------+------------+----------+---------+-------+----------------------------+-----------------+
| Id | Binary | Host | Zone | Status | State | Updated_at | Disabled Reason |
+----+------------------+------------+----------+---------+-------+----------------------------+-----------------+
| 1 | nova-conductor | controller | internal | enabled | up | 2020-11-20T10:11:31.000000 | - |
| 3 | nova-scheduler | controller | internal | enabled | up | 2020-11-20T10:11:36.000000 | - |
| 4 | nova-consoleauth | controller | internal | enabled | up | 2020-11-20T10:11:34.000000 | - |
| 7 | nova-compute | compute | nova | enabled | up | 2020-11-20T10:11:29.000000 | - |
+----+------------------+------------+----------+---------+-------+----------------------------+-----------------+
查看云主机列表
[root@controller ~]# nova list
+--------------------------------------+-------+---------+------------+-------------+----------------------------------+
| ID | Name | Status | Task State | Power State | Networks |
+--------------------------------------+-------+---------+------------+-------------+----------------------------------+
| abaa3012-f1d3-47df-90a2-3325167f6bfa | ruxin | ERROR | - | NOSTATE | |
| 6405e300-e878-4d76-8bf4-3017d9552e77 | test | SHUTOFF | - | Shutdown | int-gre=10.10.0.4, 192.168.200.5 |
+--------------------------------------+-------+---------+------------+-------------+----------------------------------+
三、Neutron 服务运维(网络)
查询网络服务
[root@controller ~]# neutron agent-list
+-------------+-------------+------------+-------------------+-------+----------------+---------------+
| id | agent_type | host | availability_zone | alive | admin_state_up | binary |
+-------------+-------------+------------+-------------------+-------+----------------+---------------+
| 18e7cd94-f6 | Open | compute | | :-) | True | neutron- |
| 79-447d- | vSwitch | | | | | openvswitch- |
| a8dd-b93ca3 | agent | | | | | agent |
| 8e5f6d | | | | | | |
| 588b14e0 | Loadbalance | controller | | xxx | True | neutron- |
| -989b-4ec9 | r agent | | | | | lbaas-agent |
| -963e-03bfd | | | | | | |
| a334dad | | | | | | |
| 646fa32a- | Metadata | compute | | :-) | True | neutron- |
| 93ed-4e8e-8 | agent | | | | | metadata- |
| 0e1-6c26a05 | | | | | | agent |
| dc209 | | | | | | |
| 801e1564-32 | DHCP agent | controller | nova | :-) | True | neutron-dhcp- |
| a3-4d21 | | | | | | agent |
| -b4bf-73ab8 | | | | | | |
| 0058ac1 | | | | | | |
| 8e69e8c5 | Open | controller | | :-) | True | neutron- |
| -76bf-4cb8 | vSwitch | | | | | openvswitch- |
| -b9de-8390d | agent | | | | | agent |
| 7fdfeba | | | | | | |
| 9ae0042b- | Metadata | controller | | :-) | True | neutron- |
| 1b52-4255 | agent | | | | | metadata- |
| -b17a-4534f | | | | | | agent |
| af099ab | | | | | | |
| d7364e76 | L3 agent | controller | nova | :-) | True | neutron-l3-ag |
| -280d-4e4c- | | | | | | ent |
| bf23-ecd8c6 | | | | | | |
| b5682d | | | | | | |
+-------------+-------------+------------+-------------------+-------+----------------+---------------+
为了查询方便,可用一些参数过滤查询
[root@controller ~]# neutron agent-list --help
usage: neutron agent-list [-h] [-f {csv,html,json,json,table,value,yaml,yaml}]
[-c COLUMN] [--max-width <integer>] [--noindent]
[--quote {all,minimal,none,nonnumeric}]
[--request-format {json}] [-D] [-F FIELD]
[--sort-key FIELD] [--sort-dir {asc,desc}]
例如,只显示alive这一列
-c :等于 -column 查看某一列
[root@controller ~]# neutron agent-list -c alive
+-------+
| alive |
+-------+
| :-) |
| xxx |
| :-) |
| :-) |
| :-) |
| :-) |
| :-) |
+-------+
多列查看
[root@controller ~]# neutron agent-list -c host -c alive
+------------+-------+
| host | alive |
+------------+-------+
| compute | :-) |
| controller | xxx |
| compute | :-) |
| controller | :-) |
| controller | :-) |
| controller | :-) |
| controller | :-) |
+------------+-------+
查看某网络的详细信息,show 后面跟ID或者名称
[root@controller ~]# neutron agent-show 18e7cd94-f679-447d-a8dd-b93ca38e5f6d
+---------------------+-------------------------------------------------------+
| Field | Value |
+---------------------+-------------------------------------------------------+
| admin_state_up | True |
| agent_type | Open vSwitch agent |
| alive | True |
| availability_zone | |
| binary | neutron-openvswitch-agent |
| configurations | { |
| | "in_distributed_mode": false, |
| | "datapath_type": "system", |
| | "arp_responder_enabled": false, |
| | "tunneling_ip": "192.168.100.20", |
| | "vhostuser_socket_dir": "/var/run/openvswitch", |
| | "devices": 1, |
| | "ovs_capabilities": { |
| | "datapath_types": [ |
| | "netdev", |
| | "system" |
| | ], |
| | "iface_types": [ |
| | "geneve", |
| | "gre", |
| | "internal", |
| | "ipsec_gre", |
| | "lisp", |
| | "patch", |
| | "stt", |
| | "system", |
| | "tap", |
| | "vxlan" |
| | ] |
| | }, |
| | "log_agent_heartbeats": false, |
| | "l2_population": true, |
| | "tunnel_types": [ |
| | "gre" |
| | ], |
| | "extensions": [], |
| | "enable_distributed_routing": false, |
| | "bridge_mappings": { |
| | "external": "br-ex" |
| | } |
| | } |
| created_at | 2020-11-19 16:45:54 |
| description | |
| heartbeat_timestamp | 2020-11-20 11:01:52 |
| host | compute |
| id | 18e7cd94-f679-447d-a8dd-b93ca38e5f6d |
| started_at | 2020-11-20 07:09:41 |
| topic | N/A |
+---------------------+-------------------------------------------------------+
查看网络信息
[root@controller ~]# neutron net-list
+--------------------------------------+---------+-------------------------------------------------------+
| id | name | subnets |
+--------------------------------------+---------+-------------------------------------------------------+
| 5f569d92-b2ce-48c2-abfe-402da25acbf8 | int-gre | a467bac2-ae9c-46b0-84d9-5aafaa466f1c 10.10.0.0/24 |
| 13929ffb-2e26-4a55-b724-019a98348692 | net-gre | 2f05621e-54e1-4bb1-ad01-c4859a7daa47 192.168.200.0/24 |
+--------------------------------------+---------+-------------------------------------------------------+
查看子网信息
[root@controller ~]# neutron subnet-list
+--------------------------------------+------------+------------------+---------------------------------------------+
| id | name | cidr | allocation_pools |
+--------------------------------------+------------+------------------+---------------------------------------------+
| a467bac2-ae9c-46b0-84d9-5aafaa466f1c | int-subnet | 10.10.0.0/24 | {"start": "10.10.0.2", "end": |
| | | | "10.10.0.254"} |
| 2f05621e-54e1-4bb1-ad01-c4859a7daa47 | net-subnet | 192.168.200.0/24 | {"start": "192.168.200.1", "end": |
| | | | "192.168.200.1"} |
| | | | {"start": "192.168.200.3", "end": |
| | | | "192.168.200.254"} |
+--------------------------------------+------------+------------------+----------
查询网络的内网的详细信息
[root@controller ~]# neutron subnet-show int-subnet
+-------------------+----------------------------------------------+
| Field | Value |
+-------------------+----------------------------------------------+
| allocation_pools | {"start": "10.10.0.2", "end": "10.10.0.254"} |
| cidr | 10.10.0.0/24 |
| created_at | 2020-11-19T17:10:18 |
| description | |
| dns_nameservers | |
| enable_dhcp | True |
| gateway_ip | 10.10.0.1 |
| host_routes | |
| id | a467bac2-ae9c-46b0-84d9-5aafaa466f1c |
| ip_version | 4 |
| ipv6_address_mode | |
| ipv6_ra_mode | |
| name | int-subnet |
| network_id | 5f569d92-b2ce-48c2-abfe-402da25acbf8 |
| subnetpool_id | |
| tenant_id | c852297c681c4ba9afe144de7f4b9802 |
| updated_at | 2020-11-19T17:10:18 |
+-------------------+----------------------------------------------+
四、Cinder 服务运维
创建硬盘
[root@controller ~]# cinder create --name test 1
+--------------------------------+--------------------------------------+
| Property | Value |
+--------------------------------+--------------------------------------+
| attachments | [] |
| availability_zone | nova |
| bootable | false |
| consistencygroup_id | None |
| created_at | 2020-11-20T11:31:03.000000 |
| description | None |
| encrypted | False |
| id | 31fd29f9-3388-43f0-b8a2-3837754fad2a |
| metadata | {} |
| migration_status | None |
| multiattach | False |
| name | test |
| os-vol-host-attr:host | None |
| os-vol-mig-status-attr:migstat | None |
| os-vol-mig-status-attr:name_id | None |
| os-vol-tenant-attr:tenant_id | c852297c681c4ba9afe144de7f4b9802 |
| replication_status | disabled |
| size | 1 |
| snapshot_id | None |
| source_volid | None |
| status | creating |
| updated_at | None |
| user_id | 4044a241e7b04403813e255f30d35a66 |
| volume_type | None |
+--------------------------------+--------------------------------------+
查看硬盘列表
(因我的没有建立成功所以状态错误)
[root@controller ~]# cinder list
+--------------------------------------+--------+-------+------+-------------+----------+-------------+
| ID | Status | Name | Size | Volume Type | Bootable | Attached to |
+--------------------------------------+--------+-------+------+-------------+----------+-------------+
| 574b3a77-c11a-412b-88df-15d332d42253 | error | test | 1 | - | false | |
| 827eb6ce-180e-4584-8c4e-32a8f98d3d55 | error | hello | 1 | liu | false | |
+--------------------------------------+--------+-------+------+-------------+----------+-------------+
查看硬盘的详细信息
[root@controller ~]# cinder show test
+--------------------------------+--------------------------------------+
| Property | Value |
+--------------------------------+--------------------------------------+
| attachments | [] |
| availability_zone | nova |
| bootable | false |
| consistencygroup_id | None |
| created_at | 2020-11-20T11:31:03.000000 |
| description | None |
| encrypted | False |
| id | 31fd29f9-3388-43f0-b8a2-3837754fad2a |
| metadata | {} |
| migration_status | None |
| multiattach | False |
| name | test |
| os-vol-host-attr:host | None |
| os-vol-mig-status-attr:migstat | None |
| os-vol-mig-status-attr:name_id | None |
| os-vol-tenant-attr:tenant_id | c852297c681c4ba9afe144de7f4b9802 |
| replication_status | disabled |
| size | 1 |
| snapshot_id | None |
| source_volid | None |
| status | error |
| updated_at | 2020-11-20T11:31:07.000000 |
| user_id | 4044a241e7b04403813e255f30d35a66 |
| volume_type | None |
+--------------------------------+--------------------------------------+
删除硬盘
[root@controller ~]# cinder delete test
Request to delete volume test has been accepted.
[root@controller ~]# cinder list //(查询,没有了)
+----+--------+------+------+-------------+----------+-------------+
| ID | Status | Name | Size | Volume Type | Bootable | Attached to |
+----+--------+------+------+-------------+----------+-------------+
+----+--------+------+------+-------------+----------+-------------+
创建卷的标识(格式)
创建了两个格式,并查看
[root@controller ~]# cinder type-create liu
+--------------------------------------+------+-------------+-----------+
| ID | Name | Description | Is_Public |
+--------------------------------------+------+-------------+-----------+
| 5d3e321d-4b99-497e-b3f8-1f46e29aff3e | liu | - | True |
+--------------------------------------+------+-------------+-----------+
[root@controller ~]# cinder type-list
+--------------------------------------+------+-------------+-----------+
| ID | Name | Description | Is_Public |
+--------------------------------------+------+-------------+-----------+
| 5d3e321d-4b99-497e-b3f8-1f46e29aff3e | liu | - | True |
+--------------------------------------+------+-------------+-----------+
[root@controller ~]# cinder type-create feng
+--------------------------------------+------+-------------+-----------+
| ID | Name | Description | Is_Public |
+--------------------------------------+------+-------------+-----------+
| a4d2b00c-9ea4-43fe-a111-50bc9eb8cfc3 | feng | - | True |
+--------------------------------------+------+-------------+-----------+
[root@controller ~]# cinder type-list
+--------------------------------------+------+-------------+-----------+
| ID | Name | Description | Is_Public |
+--------------------------------------+------+-------------+-----------+
| 5d3e321d-4b99-497e-b3f8-1f46e29aff3e | liu | - | True |
| a4d2b00c-9ea4-43fe-a111-50bc9eb8cfc3 | feng | - | True |
±-------------------------------------±-----±------------±
创建带有标识的卷(给某一个卷一个格式)
[root@controller ~]# cinder create --name hello --volume-type liu 1
+--------------------------------+--------------------------------------+
| Property | Value |
+--------------------------------+--------------------------------------+
| attachments | [] |
| availability_zone | nova |
| bootable | false |
| consistencygroup_id | None |
| created_at | 2020-11-20T12:53:13.000000 |
| description | None |
| encrypted | False |
| id | 827eb6ce-180e-4584-8c4e-32a8f98d3d55 |
| metadata | {} |
| migration_status | None |
| multiattach | False |
| name | hello |
| os-vol-host-attr:host | None |
| os-vol-mig-status-attr:migstat | None |
| os-vol-mig-status-attr:name_id | None |
| os-vol-tenant-attr:tenant_id | c852297c681c4ba9afe144de7f4b9802 |
| replication_status | disabled |
| size | 1 |
| snapshot_id | None |
| source_volid | None |
| status | creating |
| updated_at | None |
| user_id | 4044a241e7b04403813e255f30d35a66 |
| volume_type | liu |
+--------------------------------+--------------------------------------+
卷硬盘改名
cinder rename 卷名 新名字
重启cinder服务
1.在compute节点执行
ntpdate controller
2.在compute节点执行
service openstack-cinder-volume restart
五、swift 服务运维
创建容器
[root@controller ~]# swift post fff
查看容器列表
[root@controller ~]# swift list
fff
删除容器
[root@controller ~]# swift delete fff
fire/two.doc
fire
fff
上传文件
[root@controller ~]# ll
total 7025752
-rw-------. 1 root root 1369 Nov 19 22:35 anaconda-ks.cfg
-rw-r--r--. 1 root root 4329570304 Jun 7 2019 CentOS-7-x86_64-DVD-1511.iso
-rw-r--r--. 1 root root 13287936 Nov 20 16:58 cirros-0.3.4-x86_64-disk.img
-rw-r--r--. 1 root root 0 Nov 20 16:29 one.txt
-rw-r--r--. 1 root root 0 Nov 20 16:30 three.png
-rw-r--r--. 1 root root 0 Nov 20 16:29 two.doc
-rw-r--r--. 1 root root 2851502080 Nov 6 2017 XianDian-IaaS-v2.2.iso
[root@controller ~]# mkdir fire // 在本地建立一个文件家上传
[root@controller ~]# swift upload fff fire // 上传文件夹
fire
[root@controller ~]# swift list fff // 查看容器内容
fire
[root@controller ~]# swift upload fff/fire two.doc // 向容器中的文件夹添加文件
fire/two.doc
[root@controller ~]# swift list fff //查看
fire
fire/two.doc
下载文件
[root@controller ~]# ll // 本地没有fire文件
total 7025752
-rw-------. 1 root root 1369 Nov 19 22:35 anaconda-ks.cfg
-rw-r--r--. 1 root root 4329570304 Jun 7 2019 CentOS-7-x86_64-DVD-1511.iso
-rw-r--r--. 1 root root 13287936 Nov 20 16:58 cirros-0.3.4-x86_64-disk.img
-rw-r--r--. 1 root root 0 Nov 20 16:29 one.txt
-rw-r--r--. 1 root root 0 Nov 20 16:30 three.png
-rw-r--r--. 1 root root 0 Nov 20 16:29 two.doc
-rw-r--r--. 1 root root 2851502080 Nov 6 2017 XianDian-IaaS-v2.2.iso
[root@controller ~]# swift download fff fire // 下载fire文件
fire [auth 2.409s, headers 3.062s, total 3.065s, 0.000 MB/s]
[root@controller ~]# ll // 查看已经有了fire文件
total 7025752
-rw-------. 1 root root 1369 Nov 19 22:35 anaconda-ks.cfg
-rw-r--r--. 1 root root 4329570304 Jun 7 2019 CentOS-7-x86_64-DVD-1511.iso
-rw-r--r--. 1 root root 13287936 Nov 20 16:58 cirros-0.3.4-x86_64-disk.img
drwxr-xr-x. 2 root root 6 Nov 20 21:26 fire
-rw-r--r--. 1 root root 0 Nov 20 16:29 one.txt
-rw-r--r--. 1 root root 0 Nov 20 16:30 three.png
-rw-r--r--. 1 root root 0 Nov 20 16:29 two.doc
-rw-r--r--. 1 root root 2851502080 Nov 6 2017 XianDian-IaaS-v2.2.iso
查看状态
[root@controller ~]# swift stat
Account: AUTH_c852297c681c4ba9afe144de7f4b9802
Containers: 1
Objects: 0
Bytes: 0
Containers in policy "policy-0": 1
Objects in policy "policy-0": 0
Bytes in policy "policy-0": 0
X-Account-Project-Domain-Id: 42f8d80362b44356ba01b8386ce4786c
X-Timestamp: 1606231423.60619
X-Trans-Id: txf49eba49fbb34712ab9f2-005fb7c50f
Content-Type: text/plain; charset=utf-8
Accept-Ranges: bytes