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

Openstack Learning-Mirror Management

2025-01-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

The test performs basic operations such as image download, creation, registration and image format conversion through Openstack Dashboard and Openstack CLI. Refer to the HCIP-Cloud_Computing-OpenStack_V1.0_ Experimental Manual

The experimental procedure is as follows:

Openstack dashboard operation to create a mirror

Cirros image is a relatively small Linux image (about 12m). The image format is QCOW2. You can register and use it directly after download.

Download address http://donload.cirros-cloud.net/0.4.0/

Select "cirros-0.4.0-x86_64-disk.img"

When using the admin user login Openstack Dashboard interface, select "Project-calculation-Image" in the left navigation bar, enter the image list, and click "create Image".

Create a mirror using the following information

Image name, Img_web

Image format, select QCOW2-QEMU Emulator

Minimum disk, select 1GB

Minimum RAM, select 128MB

Image sharing. Choosing public means that the image can be shared by other projects. Private means that the image can only be used by the project to which it belongs. Select private here.

Protected. Select to indicate that the image is not allowed to be deleted. Choose whether or not to indicate that the image can be deleted. Select Yes here.

Click "create Mirror" to complete the creation of the mirror

Return the list of images and wait for the image status to become "running", indicating that the image has been registered successfully

Modify the mirror image

Select "Project-calculation-Mirror" and select "Edit Mirror" in the operation list.

You can modify the image information in the following pop-up interface

Download image for openstack cli operation

Download the image (cirros) and upload the image file to the controller node in the host

Scp-P 2230 cirros-0.4.0-x86_64-disk.img osbash@127.0.0.1:/home/osbash

Log in to the controller node to view the details of the image file

Qemu-img info cirros-0.4.0-x86_64-disk.img

Create a registration image

Import admin user environment variables

The command related to openstack image is openstack image

Create an image "Img_cli" with a format of "QCOW2" and set it to "Private" and "Protected"

Openstack image create-- disk-format qcow2-- container-format bare-- min-disk 1-- min-ram 128--private-- protected-- file. / cirros-0.4.0-x86_64-disk.img Img_cli

Then view the list of images

Openstack image list

Modify Mirror

Set the mirror to "public"

Openstack image set-public-unprotected Img_cli

View image details

Openstack image show Img_cli

Shared image

Set the mirror to "shared"

Openstack image set-shared Img_cli

Import the environment variable of the user "User_cli_01" to see if the image "Img_cli" appears in the image list.

. User_cli_01-openrc.shopenstack image list

As you can see, after changing to sharing, the mirror Img_cli will be seen by the user User_cli_01-openrc.sh

Import the environment variables of admin and view the list of images and projects

. Admin-openrc.shopenstack image listopenstack project list

Record the ID of the images "Img_cli" and "Project_cli"

Add the image "Img_cli" to the project "Project_cli"

Openstack image add project

When the execution is complete, view the status as "pending"

Import the environment variable of the user "User_cli_01" to see if the shared image can be displayed

. User_cli_01-openrc.shopenstack image list

Convert image format

The QCOW2 format supports image compression, so images in other formats are usually converted to QCOW2 format and uploaded to openstack.

This time, the Ubuntu image of the test VMDK format is converted to QCOW2 format.

First download the ubuntu image

Wget http://cloud-images.ubuntu.com/bionic/current/bionic-server-cloudimg-amd64.vmdk

Then copy the image file to the / home/osbash directory of the Controller node

Scp-P 2230 bionic-server-cloudimg-amd64.vmdk osbash@127.0.0.1:/home/osbash

Then go to the controller node, import the user admin environment variable, and view the image file

Ssh-p 2230 osbash@127.0.0.1. Admin_openrc.shqemu-img info bionic-server-cloudimg-amd64.vmdk

Execute the following command to convert the image from VMDK format to QCOW2 format

Qemu-img convert-f vmdk-O qcow2-c-p bionic-server-cloudimg-amd64.vmdk bionic-server-cloudimg-amd64.qcow2

Where:

-f specifies the image format of the input disk

-O specifies the output format

-c targets can only be compressed into QCOW2 format

-p shows the progress of the conversion

Wait for the image format conversion to complete

Execute the following command to view the image format information after conversion

Qemu-img info bionic-server-cloudimg-amd64.qcow2

Execute the following command to create an image Ubuntu_cli with the format of QCOW2 and the image status of Public and Unprotected

Openstack image create-- disk-format qcow2-- container-format bare-- min-disk 1-- min-ram 128--public-- unprotected-- file. / bionic-server-cloudimg-amd64.qcow2 Ubuntu_cli

Export Mirror

View the list of images

Openstack image list

Save the image "Ubuntu_cli" to local

Openstack image save-file Ubuntu.qcow2 Ubuntu_cli

Then view the saved image file

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