and cons and usage scenarios
play

and cons, and usage scenarios Jia Zeng zengjia@awcloud.com Dongcan - PowerPoint PPT Presentation

Several ways to create a virtual machine image, pros and cons, and usage scenarios Jia Zeng zengjia@awcloud.com Dongcan Ye yedongcan@awcloud.com www.awcloud.com 01 Background 02 Methods of creating instance


  1. Several ways to create a virtual machine image, pros and cons, and usage scenarios Jia Zeng – zengjia@awcloud.com Dongcan Ye – yedongcan@awcloud.com 解云惑 · 简为道 www.awcloud.com

  2. 01 Background 02 Methods of creating instance image CONTENTS 03 Pros and Cons 04 Usage scenarios 05 Operation demonstration 06 Discussion

  3. Background In OpenStack, Glance service provide OS images for instance. slow Some users wants to save instance(running or not) as take space Create images based images. on instance From end-user doubt : ...... 1. How to create images based on instance? 2. Which way is better? 3. How to use those methods for different scenarios? 解云惑 · 简为道 www.awcloud.com

  4. Methods for instance to create images There are two methods for instance to create image: From Nova side : # nova image-create <server> <name> From Cinder side : # cinder upload-to-image <volume> <image-name> 解云惑 · 简为道 www.awcloud.com

  5. Methods for instance to create images 1. Call Nova API createImage Nova createImage API 2. Determine instance is volume backend or not YES NO 3. If volume backend instance, is_volume_bac call Cinder snapshot kend_instance interface call Cinder call Nova snapshot 4. Otherwise call Nova libvirt snapshot driver to live snapshot or cold snapshot snapshot upload create snapshot to Glance , create mapping mapping info update Glance DB 解云惑 · 简为道 www.awcloud.com

  6. Methods for instance to create images (1) non-volume backend instance snapshot An instance’s root disk copy, • then upload to Glance. check Yes No requirement cold/live snapshot • for live snapshot direct_snapshot for RBD, if • suspend direct_snapshot not support or blockJobAbort instance failed, do standard snapshot. direct_snapshot Freeze filesystems • create snapshot the root disk and • snapshot clone it into Ceph Glance's Create snapshot pool flatten the osd image • resume after all done with the • Thaw filesystems instance source snapshot, clean it up makes a protected snapshot • called 'snap' on uploaded images 解云惑 · 简为道 www.awcloud.com

  7. Methods for instance to create images snapshot_volume_backed (2) volume backend instance Freeze the guest filesystems(QGA supported) • Quiesce instance Call Cinder API to create snapshot • Thaw the guest filesystems • Cinder create_snapshot_force Update Glance image meta and snapshot • mapping Unquiesce instance This is the most common scenario Update Glance image meta and snapshot mapping 解云惑 · 简为道 www.awcloud.com

  8. Methods for instance to create images Cinder 2. From Cinder side volume_upload_image API Upload volume to Glance, we can specify disk-format for the new image: call Glance create image info qcow2: upload quickly and take less • space raw: upload slowly and take more • copy_volume_to_image space disk- Yes No copy_volume_to_image: get volume info, format not convert _attach_volume convert to qcow2 • is RAW? RBD: rbd export • upload volume to Glance, update image info 解云惑 · 简为道 www.awcloud.com

  9. Pros and Cons Interface description Pros Cons nova image-create Create snapshot for upload fast The new image may • root disk, upload to Freeze the guest relay on the root disk • Glance image filesystems, can and snapshot make data consistency cinder upload-to- Convert the disk to upload fast Cinder will not • • image --disk qcow2 qcow2, then upload take up less space freeze the disk • to Glance image has no relationship • with original root disk cinder upload-to- Directly upload the After convert to raw upload slow • • image disk to Glance image, create take up more • --disk raw image instance will be space faster Cinder will not • freeze the disk 解云惑 · 简为道 www.awcloud.com

  10. Usage scenarios 1. Nova image-create For the instance boot from image, we can produce image for the instance, this is • uncommon case. For the instance boot from volume, if user wants to produce image quickly, and finally no • need to delete root disk and snapshot, this is common case. 解云惑 · 简为道 www.awcloud.com

  11. Usage scenarios 2. Cinder upload-to-image • Upload disk(root disk) to Glance with qcow format, this is common case. We can delete the original disk, and uploads quickly. • Upload disk(root disk) to Glance with raw format, this is also common case. If user has no requirement for the speed, we can use this way. As we know, create instance with the raw image will quicker than others.(For RBD driver) 解云惑 · 简为道 www.awcloud.com

  12. Operation demonstration Create volume backend VM: # nova boot volume-vm --flavor 4d360a12-991a-4e08-bd1b-3bab987353bd --nic net- id=e44c3bac-6fea-4b04-8680-30e60d2e4aa1 --block-device id=f0a7da4d-2c70-47eb-a67a- 71a04d6678de,source=image,dest=volume,size=100,bootindex=0 Create local VM: # nova boot local-vm --flavor 4d360a12-991a-4e08-bd1b-3bab987353bd --nic net- id=e44c3bac-6fea-4b04-8680-30e60d2e4aa1 --block-device id=f0a7da4d-2c70-47eb-a67a- 71a04d6678de,source=image,dest=local,size=20,bootindex=0 Nova side create image: # nova image-create SERVER IMAGE-NAME Cinder side create image: # cinder upload-to-image --force True --disk-format raw VOLUME-ID IMAGE-NAME # cinder upload-to-image --force True --disk-format qcow2 VOLUME-ID IMAGE-NAME 解云惑 · 简为道 www.awcloud.com

  13. Discussion Optimization for Cinder upload-to-image 1. https://blueprints.launchpad.net/cinder/+spec/optimze-rbd-copy-volume-to-image Not implemented yet, for the RBD driver. Cinder and Glance both has Ceph RBD backend, use volume copy function instead of rbd export. 2. https://review.opendev.org/#/c/668943 While uploading volume to Glance, if disk-format is qcow2, compress images with command ” qemu-img convert –c” 3. https://review.opendev.org/#/c/668825/ Leverage hardware accelerator to do the image compression. The only accelerator supported in Train release is Intel QuickAssist Technology (QAT) 解云惑 · 简为道 www.awcloud.com

  14. THANKS! 解云惑 · 简为道 www.awcloud.com

Recommend


More recommend