块存储
块存储类型的存储域目录结构
[root@host71 data-center]# tree ├── 06744c70-a484-11e9-b4f5-00163e113cd4 #存储池UUID │ ├── 9a68474a-72cf-4773-bce7-37cf32dcf533 -> /rhev/data-center/mnt/blockSD/9a68474a-72cf-4773-bce7-37cf32dcf533 #存储域UUID │ └── mastersd -> /rhev/data-center/mnt/blockSD/9a68474a-72cf-4773-bce7-37cf32dcf533 #主存储域链接 └── mnt └── blockSD #块设备类型存储域主目录 └── 9a68474a-72cf-4773-bce7-37cf32dcf533 #某存储域UUID ├── dom_md #某存储域metadata主目录,元数据文件都是特殊的设备文件(本质为LV) │ ├── ids -> /dev/9a68474a-72cf-4773-bce7-37cf32dcf533/ids #sanlock中的lockspace │ ├── inbox -> /dev/9a68474a-72cf-4773-bce7-37cf32dcf533/inbox #主机和spm主机邮件通信相关 │ ├── leases -> /dev/9a68474a-72cf-4773-bce7-37cf32dcf533/leases #sanlock中的resource │ ├── master -> /dev/9a68474a-72cf-4773-bce7-37cf32dcf533/master │ ├── metadata -> /dev/9a68474a-72cf-4773-bce7-37cf32dcf533/metadata #记录存储域中所有磁盘的元数据 │ ├── outbox -> /dev/9a68474a-72cf-4773-bce7-37cf32dcf533/outbox #主机和spm主机邮件通信相关 │ └── xleases -> /dev/9a68474a-72cf-4773-bce7-37cf32dcf533/xleases #记录虚拟机在leases上的偏移 ├── ha_agent #ha服务所需的相关元数据 │ ├── hosted-engine.lockspace -> /var/run/vdsm/storage/9a68474a-72cf-4773-bce7-37cf32dcf533/50440683-0c8f-4cb6-96ae-b59741bbc4f0/6d02dd9e-c47d-40da-a5fb-4c85d10cffe0 #sanlock中的lockspace │ └── hosted-engine.metadata -> /var/run/vdsm/storage/9a68474a-72cf-4773-bce7-37cf32dcf533/b17573b8-3e9a-4779-9cc8-f5a4d6465f86/9443a37c-8532-4b20-8165-1d3ce39544da #记录了各个主机上engine虚拟机相关的状态 ├── images #虚拟机磁盘镜像主目录 │ ├── 0318590d-8865-468c-9ea2-47c0c6f4286f #某虚拟机磁盘相关数据目录(镜像UUID) │ │ └── 8eec4a08-5c2f-43be-a85f-5d42bc24ec5a -> /dev/9a68474a-72cf-4773-bce7-37cf32dcf533/8eec4a08-5c2f-43be-a85f-5d42bc24ec5a #某虚拟机磁盘镜像文件 (volume UUID) │ ├── 0b858a63-3d02-4d4b-8694-077420384976 │ │ └── ee525d83-62c4-4e8f-99e5-1c8f37c9a95e -> /dev/9a68474a-72cf-4773-bce7-37cf32dcf533/ee525d83-62c4-4e8f-99e5-1c8f37c9a95e │ ├── 12b7d2ab-bd59-4968-a625-6c41afadae4e │ │ └── 895de693-653f-425a-9cd6-d7da2271fc5d -> /dev/9a68474a-72cf-4773-bce7-37cf32dcf533/895de693-653f-425a-9cd6-d7da2271fc5d │ ├── 38321d17-0f59-430b-84a9-50361ce1dc59 │ │ └── d747118c-b879-4b78-83ff-e3602f48161f -> /dev/9a68474a-72cf-4773-bce7-37cf32dcf533/d747118c-b879-4b78-83ff-e3602f48161f │ ├── 3833716e-96a2-4871-a329-d9fc817351c1 │ │ └── 3157519f-8031-4293-8b47-586261707ba8 -> /dev/9a68474a-72cf-4773-bce7-37cf32dcf533/3157519f-8031-4293-8b47-586261707ba8 │ └── f916e450-4320-49a5-9b91-937be9d5e843 │ └── dc30a841-7698-4f37-aa55-61741d51272a -> /dev/9a68474a-72cf-4773-bce7-37cf32dcf533/dc30a841-7698-4f37-aa55-61741d51272a └── master #记录ovirt环境上的任务(块存储域类型时,只有SPM主机可以看到master下的内容)
查看块存储域(name=9a68474a-72cf-4773-bce7-37cf32dcf533)的元数据
1.存储域名称和LVM卷组的名称相同 2.存储域的元数据存储在LVM卷组的tags中 [root@host71 dom_md]# vgs --noheadings --units b --nosuffix --separator '|' --ignoreskippedcluster -o uuid,name,tags 9a68474a-72cf-4773-bce7-37cf32dcf533 CiZcFZ-JTO8-Tcjt-xolR-YByB-VBfU-WYgnla| #卷组的UUID 9a68474a-72cf-4773-bce7-37cf32dcf533| #存储域的name MDT_ALIGNMENT=1048576, #存储域的tags,记录了存储域的元数据 MDT_BLOCK_SIZE=512, #块大小 MDT_CLASS=Data, #存储域的类型(Data) MDT_DESCRIPTION=hosted_storage, #存储域的描述(hosted_storage) MDT_IOOPTIMEOUTSEC=10, #存储域IO操作超时时间(10秒) MDT_LEASERETRIES=3, MDT_LEASETIMESEC=60, MDT_LOCKPOLICY=, MDT_LOCKRENEWALINTERVALSEC=5, MDT_MASTER_VERSION=1, MDT_POOL_DESCRIPTION=Default, #存储池的描述 MDT_POOL_DOMAINS=9a68474a-72cf-4773-bce7-37cf32dcf533:Active, #存储池中的存储域及状态 MDT_POOL_SPM_ID=-1, MDT_POOL_SPM_LVER=-1, MDT_POOL_UUID=06744c70-a484-11e9-b4f5-00163e113cd4, #存储池的UUID MDT_PV0=pv:360000000000000000e00000000010001&44&uuid:D8BPtO-2meO-M7xO-MUJW-v8M7-hClQ-VcDkNo&44&pestart:0&44&pecount:7450&44&mapoffset:0, MDT_ROLE=Master, MDT_SDUUID=9a68474a-72cf-4773-bce7-37cf32dcf533, #存储域的UUID MDT_TYPE=ISCSI, #存储的类型 MDT_VERSION=5, #存储的版本 MDT_VGUUID=CiZcFZ-JTO8-Tcjt-xolR-YByB-VBfU-WYgnla, #卷组的UUID MDT__SHA_CKSUM=66763f669aabe7525e5b13fb82c90158551eacb0,RHAT_storage_domain
修改存储域中的元数据
#修改存储域元数据的命令样例 vgchange --deltag "MDT_POOL_UUID=82669ab0-89ba-11ea-b7d9-00163efba8c0" --addtag "MDT_POOL_UUID=" 32f3005e-e40c-49d4-a22e-a83579a6f2cc vgchange --deltag "MDT_POOL_UUID=" --addtag "MDT_POOL_UUID=82669ab0-89ba-11ea-b7d9-00163efba8c0" 32f3005e-e40c-49d4-a22e-a83579a6f2cc vgchange --deltag "MDT__SHA_CKSUM=71cc4aeab08ed4ed0c411a6803118eabb610b635" --addtag "MDT__SHA_CKSUM=4c13b0793d40dfe1cd0430c6f674882fba989e12" 32f3005e-e40c-49d4-a22e-a83579a6f2cc vgchange --deltag "MDT__SHA_CKSUM=4c13b0793d40dfe1cd0430c6f674882fba989e12" --addtag "MDT__SHA_CKSUM=71cc4aeab08ed4ed0c411a6803118eabb610b635" 32f3005e-e40c-49d4-a22e-a83579a6f2cc #查看修改前元数据 [root@host71 32f3005e-e40c-49d4-a22e-a83579a6f2cc]# vgs --noheadings --units b --nosuffix --separator '|' --ignoreskippedcluster -o uuid,name,attr,size,free,extent_size,extent_count,free_count,tags,vg_mda_size,vg_mda_free,lv_count,pv_count,pv_name 32f3005e-e40c-49d4-a22e-a83579a6f2cc VJIILl-7xms-olhA-UEpi-48cC-FTBo-tERrXG|32f3005e-e40c-49d4-a22e-a83579a6f2cc|wz--n-|160658620416|153410863104|134217728|1197|1143|MDT_ALIGNMENT=1048576,MDT_BLOCK_SIZE=512,MDT_CLASS=Data,MDT_DESCRIPTION=iscsi-150,MDT_IOOPTIMEOUTSEC=10,MDT_LEASERETRIES=3,MDT_LEASETIMESEC=60,MDT_LOCKPOLICY=,MDT_LOCKRENEWALINTERVALSEC=5,MDT_POOL_UUID=82669ab0-89ba-11ea-b7d9-00163efba8c0,MDT_PV0=pv:3600d0231000c352364ee42c200ff242b&44&uuid:dKW9XB-f5kD-LceD-VCNy-P58T-9VQQ-3Z4f1T&44&pestart:0&44&pecount:1197&44&mapoffset:0,MDT_ROLE=Regular,MDT_SDUUID=32f3005e-e40c-49d4-a22e-a83579a6f2cc,MDT_TYPE=ISCSI,MDT_VERSION=5,MDT_VGUUID=VJIILl-7xms-olhA-UEpi-48cC-FTBo-tERrXG,MDT__SHA_CKSUM=71cc4aeab08ed4ed0c411a6803118eabb610b635,RHAT_storage_domain|134217728|67103232|10|1|/dev/mapper/3600d0231000c352364ee42c200ff242b #执行修改元数据 [root@host71 32f3005e-e40c-49d4-a22e-a83579a6f2cc]# vgchange --deltag "MDT_POOL_UUID=82669ab0-89ba-11ea-b7d9-00163efba8c0" --addtag "MDT_POOL_UUID=" 32f3005e-e40c-49d4-a22e-a83579a6f2cc Volume group "32f3005e-e40c-49d4-a22e-a83579a6f2cc" successfully changed #查看修改后的元数据 [root@host71 32f3005e-e40c-49d4-a22e-a83579a6f2cc]# vgs --noheadings --units b --nosuffix --separator '|' --ignoreskippedcluster -o uuid,name,attr,size,free,extent_size,extent_count,free_count,tags,vg_mda_size,vg_mda_free,lv_count,pv_count,pv_name 32f3005e-e40c-49d4-a22e-a83579a6f2cc VJIILl-7xms-olhA-UEpi-48cC-FTBo-tERrXG|32f3005e-e40c-49d4-a22e-a83579a6f2cc|wz--n-|160658620416|153410863104|134217728|1197|1143|MDT_ALIGNMENT=1048576,MDT_BLOCK_SIZE=512,MDT_CLASS=Data,MDT_DESCRIPTION=iscsi-150,MDT_IOOPTIMEOUTSEC=10,MDT_LEASERETRIES=3,MDT_LEASETIMESEC=60,MDT_LOCKPOLICY=,MDT_LOCKRENEWALINTERVALSEC=5,MDT_POOL_UUID=,MDT_PV0=pv:3600d0231000c352364ee42c200ff242b&44&uuid:dKW9XB-f5kD-LceD-VCNy-P58T-9VQQ-3Z4f1T&44&pestart:0&44&pecount:1197&44&mapoffset:0,MDT_ROLE=Regular,MDT_SDUUID=32f3005e-e40c-49d4-a22e-a83579a6f2cc,MDT_TYPE=ISCSI,MDT_VERSION=5,MDT_VGUUID=VJIILl-7xms-olhA-UEpi-48cC-FTBo-tERrXG,MDT__SHA_CKSUM=71cc4aeab08ed4ed0c411a6803118eabb610b635,RHAT_storage_domain|134217728|67103232|10|1|/dev/mapper/3600d0231000c352364ee42c200ff242b
查看虚拟机磁盘在元数据卷(/dev/9a68474a-72cf-4773-bce7-37cf32dcf533/metadata)中的offset
[root@host71 dom_md]# lvs --noheadings --units b --nosuffix --separator '|' --ignoreskippedcluster -o uuid,name,tags 9a68474a-72cf-4773-bce7-37cf32dcf533/8eec4a08-5c2f-43be-a85f-5d42bc24ec5a 73Ye4U-QZtj-Ieh7-TiMK-rwmj-4eWG-SQwAMT |8eec4a08-5c2f-43be-a85f-5d42bc24ec5a |IU_0318590d-8865-468c-9ea2-47c0c6f4286f, #磁盘image UUID MD_13, #磁盘元数据的offset PU_00000000-0000-0000-0000-000000000000 #磁盘的parent UUID
查看虚拟机磁盘的元数据
1.元数据offset的计算公式如下
MEGAB = 2 ** 20 # = 1024 ** 2 = 1 MiB METADATA_BASE_V5 = constants.MEGAB METADATA_SLOT_SIZE_V5 = 8192 #(8k) OFFSET = METADATA_BASE_V5 + slot * METADATA_SLOT_SIZE_V5 以卷8eec4a08-5c2f-43be-a85f-5d42bc24ec5a的offset=13为例: OFFSET = 1M + 13*8K = 1024k + 104k = 1124k 即该卷的元数据在/dev/9a68474a-72cf-4773-bce7-37cf32dcf533/metadata(size=128M)的1124k位置上
2.导出/dev/9a68474a-72cf-4773-bce7-37cf32dcf533/metadata的数据到文件中
dd if=/dev/9a68474a-72cf-4773-bce7-37cf32dcf533/metadata of=/root/metadata
3.查看/root/metadata的部分内容
#cat /root/metadata CTIME=1563181741 #创建时间 DESCRIPTION={"DiskAlias":"cn_windows_10_enterprise_version_1607_updated_jul_2016_x64_dvd_9057083.iso","DiskDescription":"Uploaded iso"} #磁盘描述 DISKTYPE=ISOF #磁盘类型(ISOF,DATA,MEMD, MEMM, OVFS, HEVD, HESD, HEMD, ) DOMAIN=9a68474a-72cf-4773-bce7-37cf32dcf533 #存储域的UUID FORMAT=RAW #磁盘格式(RAW,COW) GEN=0 IMAGE=5277c6f5-83bc-4e4f-8e84-efe893a2bb9a #镜像的UUID LEGALITY=LEGAL #磁盘合法性(ILLEGAL:不合法的,LEGAL:合法的, FAKE:伪造的) PUUID=00000000-0000-0000-0000-000000000000 #parent磁盘UUID TYPE=PREALLOCATED #预分配 (PREALLOCATED, UNKNOWN, SPARSE) VOLTYPE=LEAF #卷类型 (SHARED:共享卷, INTERNAL:内部卷, LEAF:叶子卷) EOF CTIME=1563264150 DESCRIPTION={"DiskAlias":"_win7_os_disk","DiskDescription":""} DISKTYPE=DATA DOMAIN=9a68474a-72cf-4773-bce7-37cf32dcf533 FORMAT=COW GEN=0 IMAGE=ed776c6f-3b88-49a1-a99e-37b16693370c LEGALITY=LEGAL PUUID=00000000-0000-0000-0000-000000000000 TYPE=SPRSE VOLTYPE=SHARED EOF [root@host71 dom_md]# head -100 metadata #查看数据的前100行 CAP=134217728 CTIME=1597307496 DESCRIPTION={"Updated":true,"Size":10240,"Last Updated":"Tue Sep 01 14:34:55 CST 2020","Storage Domains":[{"uuid":"856db7cd-9861-428d-bc28-248bc636800b"}],"Disk Description":"OVF_STORE"} DISKTYPE=OVFS DOMAIN=856db7cd-9861-428d-bc28-248bc636800b FORMAT=RAW GEN=0 IMAGE=c7770baf-3dd9-4955-8ea0-b6bbdaf30e14 LEGALITY=LEGAL PUUID=00000000-0000-0000-0000-000000000000 TYPE=PREALLOCATED VOLTYPE=LEAF EOF #每个磁盘的分割符 CAP=134217728 CTIME=1597307498 DESCRIPTION={"Updated":true,"Size":10240,"Last Updated":"Tue Sep 01 14:34:55 CST 2020","Storage Domains":[{"uuid":"856db7cd-9861-428d-bc28-248bc636800b"}],"Disk Description":"OVF_STORE"} DISKTYPE=OVFS DOMAIN=856db7cd-9861-428d-bc28-248bc636800b FORMAT=RAW GEN=0 IMAGE=010175b5-f8de-4aa9-84ef-2980b0b6b685 LEGALITY=LEGAL PUUID=00000000-0000-0000-0000-000000000000 TYPE=PREALLOCATED VOLTYPE=LEAF EOF #每个磁盘的分割符 CAP=17179869184 CTIME=1600599232 DESCRIPTION=None #描述为None的表示该磁盘已经被删除,不在存储域中存在了。 DISKTYPE=DATA DOMAIN=856db7cd-9861-428d-bc28-248bc636800b FORMAT=COW GEN=3 IMAGE=b9814778-8369-4875-a918-ee5af1e42044 LEGALITY=ILLEGAL PUUID=00000000-0000-0000-0000-000000000000 TYPE=SPARSE VOLTYPE=LEAF EOF #每个磁盘的分割符
文件系统
本地文件系统存储类型
[root@host70 mnt]# tree /rhev/data-center/ /rhev/data-center/ ├── 6cee7c43-fbd6-4917-9e1f-0e3b63073973 #存储池UUID │ ├── ff30c837-408a-48d2-b555-66b6f0940d41 -> /rhev/data-center/mnt/_data_images_local/ff30c837-408a-48d2-b555-66b6f0940d41 #存储域UUID │ └── mastersd -> /rhev/data-center/mnt/_data_images_local/ff30c837-408a-48d2-b555-66b6f0940d41 #主存储域链接 └── mnt └── _data_images_local -> /data/images/local #本地文件存储,软链接自/data/images/local [root@host70 mnt]# tree /data/images/local/ /data/images/local/ ├── __DIRECT_IO_TEST__ └── ff30c837-408a-48d2-b555-66b6f0940d41 #本地文件系统类型存储域主目录,目录为存储域的UUID ├── dom_md #存储域元数据主目录 │ ├── ids │ ├── inbox │ ├── leases │ ├── metadata │ └── outbox ├── images #虚拟机磁盘镜像主目录 │ ├── 0aa9f584-9dfe-46be-9d66-454a80f9db48 #虚拟机磁盘相关数据目录,image的UUID │ │ ├── 9867b66e-0be3-4cec-a3eb-138c0a5083ce #虚拟机磁盘镜像文件 │ │ └── 9867b66e-0be3-4cec-a3eb-138c0a5083ce.meta #虚拟机磁盘镜像元数据文件 │ ├── a537ee74-e7c2-4505-bd77-032a373ceba6 │ │ ├── 144e2795-ac8f-4d8f-b86c-9c3d32e3e9e2 │ │ └── 144e2795-ac8f-4d8f-b86c-9c3d32e3e9e2.meta │ └── fc378178-e89e-4292-ad4b-91fbd991cad2 │ ├── ce5b1fef-d800-43ee-bf5f-b013ee1aa4b8 │ └── ce5b1fef-d800-43ee-bf5f-b013ee1aa4b8.meta └── master ├── tasks #保存正在执行的相关任务 └── vms
本地文件系统存储域的元数据
[root@host70 dom_md]# cat /rhev/data-center/mnt/_data_images_local/ff30c837-408a-48d2-b555-66b6f0940d41/dom_md/metadata ALIGNMENT=1048576 BLOCK_SIZE=512 CLASS=Data DESCRIPTION=Local-70 IOOPTIMEOUTSEC=10 LEASERETRIES=3 LEASETIMESEC=60 LOCKPOLICY= LOCKRENEWALINTERVALSEC=5 MASTER_VERSION=1 POOL_DESCRIPTION=Local POOL_DOMAINS=ff30c837-408a-48d2-b555-66b6f0940d41:Active POOL_SPM_ID=-1 POOL_SPM_LVER=-1 POOL_UUID=6cee7c43-fbd6-4917-9e1f-0e3b63073973 REMOTE_PATH=/data/images/local ROLE=Master SDUUID=ff30c837-408a-48d2-b555-66b6f0940d41 TYPE=LOCALFS VERSION=5 _SHA_CKSUM=dec30fed3d1dd4b1566277793279ea7f2129d9f2
本地文件系统磁盘的元数据
[root@host70 b06e6408-6c83-4558-b537-456b5478fddf]# ls ba0e3b15-7325-4f4a-b819-c752316d862e be82fc54-02d2-42a5-a890-6b30eeabf4b4 ba0e3b15-7325-4f4a-b819-c752316d862e.meta be82fc54-02d2-42a5-a890-6b30eeabf4b4.meta [root@host70 b06e6408-6c83-4558-b537-456b5478fddf]# cat ba0e3b15-7325-4f4a-b819-c752316d862e.meta CAP=53687091200 CTIME=1563157068 DESCRIPTION={"DiskAlias":"_centos-7_os_disk","DiskDescription":""} DISKTYPE=DATA DOMAIN=ff30c837-408a-48d2-b555-66b6f0940d41 FORMAT=COW GEN=0 IMAGE=b06e6408-6c83-4558-b537-456b5478fddf LEGALITY=LEGAL PUUID=00000000-0000-0000-0000-000000000000 TYPE=SPARSE VOLTYPE=INTERNAL EOF [root@host70 b06e6408-6c83-4558-b537-456b5478fddf]# cat be82fc54-02d2-42a5-a890-6b30eeabf4b4.meta CAP=53687091200 CTIME=1563241362 DESCRIPTION= DISKTYPE=DATA DOMAIN=ff30c837-408a-48d2-b555-66b6f0940d41 FORMAT=COW GEN=0 IMAGE=b06e6408-6c83-4558-b537-456b5478fddf LEGALITY=LEGAL PUUID=ba0e3b15-7325-4f4a-b819-c752316d862e #由此得知,磁盘be82fc54-02d2-42a5-a890-6b30eeabf4b4的父卷为ba0e3b15-7325-4f4a-b819-c752316d862e TYPE=SPARSE VOLTYPE=LEAF EOF
查看NFS存储域的OVF文件
#进入NFS存储域的目录路径 [root@host71 nfs-66]# cd /rhev/data-center/mnt/192.168.15.66:_home_nfs/48240e7d-e8c2-4e1f-9478-ead8949c3f0c/images/395369c2-479f-44ef-9479-4b63b588238c #查看路径 [root@host71 395369c2-479f-44ef-9479-4b63b588238c]# pwd /rhev/data-center/mnt/192.168.15.66:_home_nfs/48240e7d-e8c2-4e1f-9478-ead8949c3f0c/images/395369c2-479f-44ef-9479-4b63b588238c #查看路径下的内容 [root@host71 395369c2-479f-44ef-9479-4b63b588238c]# ll total 1208 -rw-rw----. 1 vdsm kvm 184320 Oct 22 15:47 79802017-788e-4fbc-8968-bf244e34e50e #ovf磁盘文件 -rw-rw----. 1 vdsm kvm 1048576 May 6 11:29 79802017-788e-4fbc-8968-bf244e34e50e.lease -rw-r--r--. 1 vdsm kvm 430 Oct 22 15:47 79802017-788e-4fbc-8968-bf244e34e50e.meta #磁盘元数据 #查看磁盘的元数据信息 [root@host71 395369c2-479f-44ef-9479-4b63b588238c]# cat 79802017-788e-4fbc-8968-bf244e34e50e.meta CAP=134217728 CTIME=1588735759 DESCRIPTION={"Updated":true,"Size":184320,"Last Updated":"Wed Oct 21 20:23:42 CST 2020","Storage Domains":[{"uuid":"48240e7d-e8c2-4e1f-9478-ead8949c3f0c"}],"Disk Description":"OVF_STORE"} DISKTYPE=OVFS DOMAIN=48240e7d-e8c2-4e1f-9478-ead8949c3f0c FORMAT=RAW GEN=0 IMAGE=395369c2-479f-44ef-9479-4b63b588238c LEGALITY=LEGAL PUUID=00000000-0000-0000-0000-000000000000 TYPE=PREALLOCATED VOLTYPE=LEAF EOF #查看磁盘文件文件类型(归档文件) [root@host71 395369c2-479f-44ef-9479-4b63b588238c]# file 79802017-788e-4fbc-8968-bf244e34e50e 79802017-788e-4fbc-8968-bf244e34e50e: POSIX tar archive #解压文件到指定目录 [root@host71 395369c2-479f-44ef-9479-4b63b588238c]# tar xf 79802017-788e-4fbc-8968-bf244e34e50e -C /root/nfs-66 #查看解压后的文件列表 [root@host71 nfs-66]# ll -rw-r--r--. 1 root root 17110 Oct 21 19:33 061a5614-c432-42a7-b082-97b02a2d8553.ovf #某个虚拟机的ovf文件,记录虚机的信息。 -rw-r--r--. 1 root root 10529 Oct 21 19:33 17e9ed2f-e691-45fa-97a4-648502dee96d.ovf -rw-r--r--. 1 root root 8464 Oct 21 19:33 423696db-cc9a-420b-ca61-6d89c1fee2a8.ovf -rw-r--r--. 1 root root 15055 Oct 21 19:33 458b67fa-aedb-40d4-84e1-12352a36f147.ovf -rw-r--r--. 1 root root 18968 Oct 21 19:33 4b6d6e68-7f4a-4510-b46d-0f06e6a4672a.ovf -rw-r--r--. 1 root root 17094 Oct 21 19:33 6442eb4f-8856-4de0-a611-0b1f15f402c5.ovf -rw-r--r--. 1 root root 19153 Oct 21 19:33 88c6bda1-2afb-4738-b55b-5d24463486e7.ovf -rw-r--r--. 1 root root 15046 Oct 21 19:33 9c45ed69-3ee8-4b0f-a591-1727f2ac7309.ovf -rw-r--r--. 1 root root 18773 Oct 21 19:33 c6ea26ae-05d2-4a60-92fe-b15ecde2fcf6.ovf -rw-r--r--. 1 root root 16685 Oct 21 19:33 e3106814-8bce-46b6-8660-fd7b17ded106.ovf -rw-r--r--. 1 root root 7756 Oct 21 19:33 fc411631-4404-4aaf-b067-e19e536bf943.ovf -rw-r--r--. 1 root root 138 Oct 21 19:33 info.json -rw-r--r--. 1 root root 552 Oct 21 19:33 metadata.json #查看info.json文件,记录了存储域的UUID和更新时间 [root@host71 nfs-66]# cat info.json { "Last Updated" : "Wed Oct 21 19:33:34 CST 2020", "Storage Domains" : [ { "uuid" : "48240e7d-e8c2-4e1f-9478-ead8949c3f0c" } ] } #记录了虚拟机的状态 [root@host71 nfs-66]# cat metadata.json { "VM Status" : { "6442eb4f-8856-4de0-a611-0b1f15f402c5" : 0, "423696db-cc9a-420b-ca61-6d89c1fee2a8" : 0, "458b67fa-aedb-40d4-84e1-12352a36f147" : 0, "17e9ed2f-e691-45fa-97a4-648502dee96d" : 0, "fc411631-4404-4aaf-b067-e19e536bf943" : 0, "88c6bda1-2afb-4738-b55b-5d24463486e7" : 0, "c6ea26ae-05d2-4a60-92fe-b15ecde2fcf6" : 0, "4b6d6e68-7f4a-4510-b46d-0f06e6a4672a" : 0, "061a5614-c432-42a7-b082-97b02a2d8553" : 0, "e3106814-8bce-46b6-8660-fd7b17ded106" : 0, "9c45ed69-3ee8-4b0f-a591-1727f2ac7309" : 0 } }
NFS文件系统存储域的元数据
[root@host71 dom_md]# cat metadata ALIGNMENT=1048576 BLOCK_SIZE=512 CLASS=Data DESCRIPTION=nfs-66 IOOPTIMEOUTSEC=10 LEASERETRIES=3 LEASETIMESEC=60 LOCKPOLICY= LOCKRENEWALINTERVALSEC=5 POOL_UUID=82669ab0-89ba-11ea-b7d9-00163efba8c0 REMOTE_PATH=192.168.15.66:/home/nfs ROLE=Regular SDUUID=48240e7d-e8c2-4e1f-9478-ead8949c3f0c TYPE=NFS VERSION=5 _SHA_CKSUM=985bc30fb71a1535f559ea7dbaa9ac2b98cfa11e NFS类型的非主存储域分离存储池之后的情况 [root@host71 dom_md]# cat metadata ALIGNMENT=1048576 BLOCK_SIZE=512 CLASS=Data DESCRIPTION=nfs-66 IOOPTIMEOUTSEC=10 LEASERETRIES=3 LEASETIMESEC=60 LOCKPOLICY= LOCKRENEWALINTERVALSEC=5 POOL_UUID= #该值变为空(表示分离存储域时,会把存储域的元数据POOL_UUID的值设置为空) REMOTE_PATH=192.168.15.66:/home/nfs ROLE=Regular SDUUID=48240e7d-e8c2-4e1f-9478-ead8949c3f0c TYPE=NFS VERSION=5 _SHA_CKSUM=702f78af382a3a0010dd66c99057b59998697c0b #该值也会修改
将A环境上的NFS类型的存储域强制附加给B环境上
- 1.查看元数据
[root@host71 dom_md]# cat metadata ALIGNMENT=1048576 BLOCK_SIZE=512 CLASS=Data DESCRIPTION=nfs-66 IOOPTIMEOUTSEC=10 LEASERETRIES=3 LEASETIMESEC=60 LOCKPOLICY= LOCKRENEWALINTERVALSEC=5 POOL_UUID=82669ab0-89ba-11ea-b7d9-00163efba8c0 REMOTE_PATH=192.168.15.66:/home/nfs ROLE=Regular SDUUID=48240e7d-e8c2-4e1f-9478-ead8949c3f0c TYPE=NFS VERSION=5 _SHA_CKSUM=985bc30fb71a1535f559ea7dbaa9ac2b98cfa11e
- 2.将POOL_UUID中的值设置为空
[root@host71 dom_md]# cat metadata ALIGNMENT=1048576 BLOCK_SIZE=512 CLASS=Data DESCRIPTION=nfs-66 IOOPTIMEOUTSEC=10 LEASERETRIES=3 LEASETIMESEC=60 LOCKPOLICY= LOCKRENEWALINTERVALSEC=5 POOL_UUID= REMOTE_PATH=192.168.15.66:/home/nfs ROLE=Regular SDUUID=48240e7d-e8c2-4e1f-9478-ead8949c3f0c TYPE=NFS VERSION=5 _SHA_CKSUM=985bc30fb71a1535f559ea7dbaa9ac2b98cfa11e
- 3.在B环境中导入该NFS存储域。
#在导入的时候会报错,查看管理台日志 2020-10-19 16:27:58,459+08 ERROR [org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogDirector] (default task-1) [4b26de40-27a3-494a-87c5-6e096cf5f35f] EVENT_ID: VDS_BROKER_COMMAND_FAILURE(10,802), VDSM命令 host91.node15 HSMGetStorageDomainInfoVDS 失败: Meta Data seal is broken (checksum mismatch): 'cksum = 71cc4aeab08ed4 ed0c411a6803118eabb610b635, computed_cksum = 4c13b0793d40dfe1cd0430c6f674882fba989e12'。 #报错的原因是存储域中的元数据_SHA_CKSUM的值和计算得出的值computed_cksum不一致导致的。
- 4.将metadata文件中的_SHA_CKSUM的值设置为‘4c13b0793d40dfe1cd0430c6f674882fba989e12’
[root@host71 dom_md]# cat metadata ALIGNMENT=1048576 BLOCK_SIZE=512 CLASS=Data DESCRIPTION=nfs-66 IOOPTIMEOUTSEC=10 LEASERETRIES=3 LEASETIMESEC=60 LOCKPOLICY= LOCKRENEWALINTERVALSEC=5 POOL_UUID= REMOTE_PATH=192.168.15.66:/home/nfs ROLE=Regular SDUUID=48240e7d-e8c2-4e1f-9478-ead8949c3f0c TYPE=NFS VERSION=5 _SHA_CKSUM=4c13b0793d40dfe1cd0430c6f674882fba989e12
1.5.关闭在A环境上的该NFS类型存储域上的虚拟机。
1.6.将A环境中的主机关机,否则会sanlock会获取不到Host ID。
1.7.再次在B环境中执行导入存储域的操作。
PS:转载文章请注明来源:oVirt中文社区(www.cnovirt.com)
扫码加好友拉你进oVirt技术交流群!
ovirt支持已经存在的存储域导入吗?