In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-19 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.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.