Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to understand Resize Instance operation

2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article introduces you how to understand Resize Instance operation, the content is very detailed, interested friends can use for reference, I hope it can be helpful to you.

The role of Resize is to adjust the vCPU, memory, and disk resources of instance.

The number of resources required by Instance is defined in flavor, and the resize operation adjusts the allocation of resources by selecting a new flavor for instance.

With the previous analysis of Migrate, it is very simple to look at the implementation of Resize. Because the resources that instance needs to allocate have changed, you need to re-select a suitable computing node for instance with the help of nova-scheduler before resize. If the selected node is not the same as the current node, then you need to do Migrate.

So in essence: Resize is to apply the new flavor while Migrate. Migrate can be seen as a special case of resize: resize where flavor hasn't changed, which is why we saw in the previous log that migrate is actually performing a resize operation.

There are two types of Resize:

The destination node selected by nova-scheduler is different from the source node. The operation process is almost exactly the same as the previous Migrate, except that resources are allocated according to the new flavor when the target node starts the instance. At the same time, because files are to be copied across nodes, it is also necessary to ensure that the initiator of the nova-compute process (usually nova or possibly root, which can be confirmed by the ps command) has password-free access between compute nodes. We will not dwell on this situation, please refer to the previous Migrate section.

The destination node and the source node are the same node. Migrate is not required. Let's focus on this situation.

Send a request to nova-api

Customers (either OpenStack end users or other programs) send a request to API (nova-api): "help me Resize this Instance"

Select a new flavor

Click the Resize button

View log / opt/stack/logs/n-api.log

Nova-api sends messages

Nova-api sends a message to Messaging (RabbitMQ): "Resize this Instance" looks at the source code / opt/stack/nova/nova/compute/api.py, using resize_instance.

Nova-scheduler execution scheduling

When nova-scheduler receives the message, it selects the appropriate target compute node for instance. View log / opt/stack/logs/n-sch.log

Nova-scheduler selects devstack-compute1 as the destination node, which is the same as the source node.

Nova-scheduler sends messages

Nova-scheduler sends a message informing the computing node that the instance can be migrated. The source code is on line 95 of / opt/stack/nova/nova/scheduler/filter_scheduler.py. The method is select_destinations.

Nova-compute executes the operation

Starting instance on the target node is very similar to launch instance. The log is recorded in / opt/stack/logs/n-cpu.log

The following steps will be taken:

Prepare CPU, memory, and disk resources for instance by pressing the new flavor

Close instance

Create an instance image file

Make a backup copy of the directory of instance and name it _ resize for revert.

Create a XML definition file for instance

Prepare the virtual network

Start instance

Confirm

At this time, the status of the instance is in the "Confirm or Revert Resize/Migrate" state, which requires the user to confirm or reverse the current migration operation, which actually gives the user a chance to go back on his promise.

When we press the Confirm button, the following happens:

Nova-api received a message from confirm

Delete the instance directory _ resize backed up on the computing section

Revert

Conversely, what happens if you perform the Revert operation?

Nova-api received a message from revert

Turn off instance on the compute node

Restore the instance directory by backing up the directory _ resize.

Restart instance

On how to understand the operation of Resize Instance to share here, I hope that the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report