当前位置 : 主页 > 编程语言 > 其它开发 >

openstack调整云主机实例类型大小

来源:互联网 收集:自由互联 发布时间:2022-05-30
对云主机实例进行调整类型大小 修改配置文件 修改controller节点和compute节点nova.conf配置文件,添加调整类型大小的参数 controller节点设置参数如下所示 [root@controller ~]# crudini --set /etc/n
openstack调整云主机实例类型大小 对云主机实例进行调整类型大小 修改配置文件

修改controller节点和compute节点nova.conf配置文件,添加调整类型大小的参数

controller节点设置参数如下所示

[root@controller ~]# crudini --set /etc/nova/nova.conf DEFAULT allow_resize_to_same_host True
[root@controller ~]# crudini --set /etc/nova/nova.conf DEFAULT scheduler_default_filters RetryFilter,AvailabilityZoneFilter,RamFilter,ComputeFilter,ComputeCapabilitiesFilter,
ImagePropertiesFilter,ServerGroupAntiAffinityFilter,ServerGroupAffinityFilter
[root@controller ~]# systemctl restart openstack-nova*

compute节点设置参数如下所示

[root@compute ~]# crudini --set /etc/nova/nova.conf DEFAULT allow_resize_to_same_host True
[root@compute ~]# crudini --set /etc/nova/nova.conf DEFAULT scheduler_default_filters RetryFilter,AvailabilityZoneFilter,RamFilter,ComputeFilter,ComputeCapabilitiesFilter,
ImagePropertiesFilter,ServerGroupAntiAffinityFilter,ServerGroupAffinityFilter
[root@compute ~]# systemctl restart openstack-nova-compute
创建需要的云主机类型

现有云主机硬盘和内存不满足使用,需要对现有云主机进行资源扩容,将内存扩容至2G,硬盘扩容至15G大小,类型名称为“centos1”首先创建一个新的云主机类型满足扩容资源的需求。通过命令创建新云主机类型

[root@controller ~]#  openstack flavor create --disk 15 --ram 2048 --vcpus 2 centos1
+----------------------------+--------------------------------------+
| Field                      | Value                                |
+----------------------------+--------------------------------------+
| OS-FLV-DISABLED:disabled   | False                                |
| OS-FLV-EXT-DATA:ephemeral  | 0                                    |
| disk                       | 15                                   |
| id                         | 182eac11-33b4-4153-8f8f-42e67c67e8bf |
| name                       | centos1                              |
| os-flavor-access:is_public | True                                 |
| properties                 |                                      |
| ram                        | 2048                                 |
| rxtx_factor                | 1.0                                  |
| swap                       |                                      |
| vcpus                      | 2                                    |
+----------------------------+--------------------------------------+

查看当前云主机类型列表

[root@controller ~]# openstack flavor list
+--------------------------------------+---------+------+------+-----------+-------+-----------+
| ID                                   | Name    |  RAM | Disk | Ephemeral | VCPUs | Is Public |
+--------------------------------------+---------+------+------+-----------+-------+-----------+
| 1                                    | centos  | 1024 |   10 |         0 |     2 | True      |
| 182eac11-33b4-4153-8f8f-42e67c67e8bf | centos1 | 2048 |   15 |         0 |     2 | True      |
+--------------------------------------+---------+------+------+-----------+-------+-----------+

查看云主机列表,通过命令查看云主机列表

[root@controller ~]# openstack server list
+-------------------------+-------------+--------+-----------------+--------------+--------+
| ID                      | Name        | Status | Networks        | Image        | Flavor |
+-------------------------+-------------+--------+-----------------+--------------+--------+
| 7e424f14-eed1-44f5-a29a | cirros-test | ACTIVE | network-vlan=   | cirros-0.3.4 | centos |
  -0b64749cbc4d                                    192.168.200.132
+-------------------------+-------------+--------+-----------------+--------------+--------+

使用命令“openstack server resize”调整云主机类型

[root@controller ~]# openstack help server resize  
usage: openstack server resize [-h] [--flavor <flavor> | --confirm | --revert]
                               [--wait]
                               <server>

  <server>           Server (name or ID)

optional arguments:
  -h, --help         show this help message and exit
  --flavor <flavor>  Resize server to specified flavor
  --confirm          Confirm server resize is complete
  --revert           Restore server state before resize
  --wait             Wait for resize to complete
调整云主机类型

使用命令调整云主机“cirros-test”类型为centos1,使用--wait参数,在命令执行后,调整云主机需要一定时间,添加--wait参数后会在确认时回馈“complete”

[root@controller ~]# openstack server resize --flavor centos1 --wait cirros-test
Complete
[root@controller ~]# openstack server list
+-------------------------+-------------+---------------+-----------------+--------------+---------+
| ID                      | Name        | Status        | Networks        | Image        | Flavor  |
+-------------------------+-------------+---------------+-----------------+--------------+---------+
| 7e424f14-eed1-44f5-a29a | cirros-test | VERIFY_RESIZE | network-vlan=   | cirros-0.3.4 | centos1 |
  -0b64749cbc4d                                           192.168.200.132
+-------------------------+-------------+---------------+-----------------+--------------+---------+

在命令执行完毕后,返回“Complete”值时,通过命令查看云主机列表信息

[root@controller ~]# openstack server list
+-------------------------+-------------+--------+-----------------+--------------+---------+
| ID                      | Name        | Status | Networks        | Image        | Flavor  |
+-------------------------+-------------+--------+-----------------+--------------+---------+
| 7e424f14-eed1-44f5-a29a | cirros-test | ACTIVE | network-vlan=   | cirros-0.3.4 | centos1 |
  -0b64749cbc4d                                    192.168.200.132
+-------------------------+-------------+--------+-----------------+--------------+---------+
上一篇:分布式日志存储架构设计方案
下一篇:没有了
网友评论