我有一台运行 XenServer 6.5 的测试服务器,确切的版本是 6.5.0-90233c。现在我有两个 Linux(Debian 和 Ubuntu)虚拟机在顺利运行。我连接了一个 1TB 的 USB 驱动器,并成功地将整个磁盘设置为存储库 (SR)。
我想要创建要连接到虚拟机的虚拟磁盘映像。当我尝试创建虚拟磁盘映像 (VDI) 时,我的问题就开始了。无论我尝试创建的 VDI 大小如何,它都会失败。
(为了创建 VDI 而发出的命令):
xe vdi-create sr-uuid=[my SR's UUID] name-label="Virtual Disk 01 USB SR" type=user virtual-size=15GiB
返回的错误信息:
Error code: SR_BACKEND_FAILURE_78 Error parameters: VDI Creation failed [opt=error 22]
我尝试重新创建存储库,并将其类型设置为 EXT3,默认情况下为 LVM,但这并不重要,无论哪种方式都会失败。
进一步查看 /var/log/SMlog,当它失败时,它会产生以下内容:
xensvr0 SM: [24602] ['uuidgen', '-r'] xensvr0 SM: [24602] pread SUCCESS xensvr0 SM: [24602] lock: opening lock file /var/lock/sm/[my SR-uuid's value]/sr xensvr0 SM: [24602] lock: acquired /var/lock/sm/[my SR-uuid's value]/sr xensvr0 SM: [24602] vdi_create {'sr_uuid': '[my SR-uuid's value]', 'subtask_of': 'DummyRef:|dad93ce4-adf8-b4de-9df5-1b3a912bb9d3|VDI.create', 'vdi_type': 'user', 'args': ['5368709120', 'Virtual Disk 01 USB SR', '', '', 'false', '19700101T00:00:00Z', '', 'false'], 'o_direct': False, 'host_ref': 'OpaqueRef:cf883175-4885-7efc-a35c-3a8967bc447b', 'session_ref': 'OpaqueRef:d379b1bf-8d01-6143-053c-2312312b4988', 'device_config': {'device': '/dev/disk/by-id/usb-OEM_Ext_Hard_Disk_00000000D2066881-part1', 'SRmaster': 'true'}, 'command': 'vdi_create', 'sr_ref': 'OpaqueRef:54604806-2115-d3eb-55ca-43ffd2a15687', 'local_cache_sr': '28117830-ec01-f5cf-f8be-5b3c31eb7507', 'vdi_sm_config': {}} xensvr0 SM: [24602] ['/usr/sbin/td-util', 'create', 'vhd', '5120', '/var/run/sr-mount/[my SR-uuid's value]/2598c91f-fdca-40a0-a900-92a28adc6743.vhd'] xensvr0 SM: [24602] FAILED in util.pread: (rc 22) stdout: '', stderr: '' xensvr0 SM: [24602] Raising exception [78, VDI Creation failed [opterr=error 22]] xensvr0 SM: [24602] lock: released /var/lock/sm/[my SR-uuid's value]/sr xensvr0 SM: [24602] ***** generic exception: vdi_create: EXCEPTION SR.SROSError, VDI Creation failed [opterr=error 22] xensvr0 SM: [24602] File "/opt/xensource/sm/SRCommand.py", line 110, in run xensvr0 SM: [24602] return self._run_locked(sr) xensvr0 SM: [24602] File "/opt/xensource/sm/SRCommand.py", line 159, in _run_locked xensvr0 SM: [24602] rv = self._run(sr, target) xensvr0 SM: [24602] File "/opt/xensource/sm/SRCommand.py", line 215, in _run xensvr0 SM: [24602] return target.create(self.params['sr_uuid'], self.vdi_uuid, long(self.params['args'][0])) xensvr0 SM: [24602] File "/opt/xensource/sm/FileSR.py", line 521, in create xensvr0 SM: [24602] opterr='error %d' % inst.code) xensvr0 SM: [24602] File "/opt/xensource/sm/xs_errors.py", line 52, in init
xensvr0 SM: [24602] raise SR.SROSError(errorcode, errormessage) xensvr0 SM: [24602] xensvr0 SM: [24602] lock: closed /var/lock/sm/[my SR-uuid's value]/sr
对于我可能遗漏了什么有什么想法吗?
答案1
我认为您尝试在不支持 o_direct 的系统上创建文件。您使用的是 ZFS 吗?您在日志中将“o_direct”参数设置为 false,但实际上 td-util 不会在未传递 O_DIRECT 的情况下打开文件,其源代码不允许传递参数以避免 O_DIRECT。