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 repair the back-end image files of nova and hang ceph to generate virtual machine files that are 1024 times larger than bug

2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)05/31 Report--

This article is about how to fix nova's back-end image files and hang ceph to generate virtual machine files that are 1024 times larger than bug. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.

The front-end interface generates virtual machines:

1. Start with the create_image function of the RBD class of nova/virt/libvirt/imagebackend.py.

Attach the source code:

Def create_image (self, prepare_template, base, size, * args, * * kwargs):

Import pydevd

Pydevd.settrace ('192.168.10.10, port=51234, stdoutToServer=True, stderrToServer=True)

If self.rbd is None:

Raise RuntimeError (_ 'rbd python libraries not found')

If not os.path.exists (base): # check whether the path exists

Prepare_template (target=base, max_size=size, * args, * * kwargs)

Else:

Self.verify_base_size (base, size) # verifies whether the size meets the requirements, which is consistent with the previous blog local file creation analysis.

# keep using the command line import instead of librbd since it

# detects zeroes to preserve sparseness in the image

Args = ['--pool', self.pool, base, self.rbd_name] # construct virtual machine file generation parameters

If self._supports_layering ():

Args + = ['--new-format']

Args + = self._ceph_args ()

Libvirt_utils.import_rbd_image (* args) # according to 1.1

Base_size = disk.get_disk_size (base) # find the size of the base image template file

If size and size > base_size: # see figure 1-1:

Self._resize (self.rbd_name, size) # follow up to 1.2

1.1:

('rbd'' import''--pool', 'nova',' / var/lib/nova/instances/_base/8b925177989924ee3e316b28b3abc03a829fbb29', 'fec8e16e-0055-4117 Afbd845773f2 id',' admin','--conf','/ etc/ceph/ceph.conf')

Before executing this command:

After executing the command:

Rbd info:

Figure 1-1:

Where size is the falvor parameter 1G passed by the page. That is, (1024 "1024" 1024), and base_size is the cirros_ceph size of the image file.

1.2:

Def _ resize (self, volume_name, size):

Size = int (size) * units.Ki # see figure 1.2-1

With RBDVolumeProxy (self, volume_name) as vol:

Vol.resize (size) # according to

Figure 1.2-1:

1.3:

I wonder here that I can't find the resize function after that (I'll have time to study it later, so I'll focus on solving the problem first. )

After executing this command:

It was found that size was 1024GB, which was 1024 times higher than expected.

Fix bug:

In figure 1.2-1

Size = int (size) * units.Ki

Block out:

Experiment again:

Problem solved.

Thank you for reading! On "how to repair nova back-end image files hang ceph, generate virtual machine files become 1024 times larger bug" this article is shared here, I hope the above content can be of some help to you, so that you can learn more knowledge, if you think the article is good, you can share it for more people to see it!

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