直接用qemu-img rebase  这样拷贝虚拟机的就可以不会因为backing file路径折腾半天了,比如我这个nfs的,就不用真去架设一个nfs来提供backing file了。

root@xxx-PC:/var/lib/libvirt/images# qemu-img info  vm-disk-1.qcow2.abcde6f1bc874f2dbfee21ce591d8634 
image: vm-disk-1.qcow2.abcde6f1bc874f2dbfee21ce591d8634
file format: qcow2
virtual size: 200G (214748364800 bytes)
disk size: 14G
cluster_size: 65536
backing file: nfs://abcde_vs_vol_rep2/abcde_vs_vol_rep2/template/6551127500485/vm-disk-1.qcow2.abcde4ca676543088de597c8d2ccfbb8
Snapshot list:
ID        TAG                 VM SIZE                DATE       VM CLOCK
1         abcdef1bc874f2dbfee21ce591d8634_base_image_snapshot      0 2021-12-29 16:31:19   00:00:00.000
Format specific information:
    compat: 1.1
    lazy refcounts: false
    refcount bits: 16
    corrupt: false

root@xxx-PC:/var/lib/libvirt/images# qemu-img rebase -u -b vm-disk-1.qcow2.abcde4ca676543088de597c8d2ccfbb8 vm-disk-1.qcow2.abcde6f1bc874f2dbfee21ce591d8634
root@actionchen-PC:/var/lib/libvirt/images# qemu-img info  vm-disk-1.qcow2.abcde6f1bc874f2dbfee21ce591d8634 
image: vm-disk-1.qcow2.abcde6f1bc874f2dbfee21ce591d8634
file format: qcow2
virtual size: 200G (214748364800 bytes)
disk size: 14G
cluster_size: 65536
backing file: vm-disk-1.qcow2.abcde4ca676543088de597c8d2ccfbb8
Snapshot list:
ID        TAG                 VM SIZE                DATE       VM CLOCK
1         abcde6f1bc874f2dbfee21ce591d8634_base_image_snapshot      0 2021-12-29 16:31:19   00:00:00.000
Format specific information:
    compat: 1.1
    lazy refcounts: false
    refcount bits: 16
    corrupt: false

Logo

华为开发者空间,是为全球开发者打造的专属开发空间,汇聚了华为优质开发资源及工具,致力于让每一位开发者拥有一台云主机,基于华为根生态开发、创新。

更多推荐