xapi-project / xen-api

The Xapi Project's XenAPI Server
http://xenproject.org/developers/teams/xapi.html
Other
346 stars 283 forks source link

[SMAPIv3] `xe sr-create` does not report an error when `SR.attach` fails #5532

Open ydirson opened 5 months ago

ydirson commented 5 months ago

xe sr-create includes auto-plugging the PBD, and as such after SR.create calls SR.attach. If for any reason SR.attach fails, this can only be seen by an error lone in SMlog - the problem is not reported to the user making the call.

ydirson commented 5 months ago

Note this also impacts the XFS SR driver in XS8:

[root@xenserver-axftaywy ~]# xe sr-create type=xfs name-label="test xfs" device-config:device=/dev/nvme0n2
7b2dd6cb-14ba-7d5f-33a1-da2191cbb94d

[root@xenserver-axftaywy ~]# grep SMAPIv3 /var/log/SMlog|tail -2
Mar 28 13:05:39 xenserver-axftaywy SMAPIv3: [10569] - INFO - called as: ['/usr/libexec/xapi-storage-script/volume/org.xen.xapi.storage.xfs/SR.attach', '--json']
Mar 28 13:05:40 xenserver-axftaywy SMAPIv3: [10569] - ERROR - Exception in xapi.storage.plugin#012Traceback (most recent call last):#012  File "/usr/lib/python3.6/site-packages/xapi/storage/libs/util.py", line 252, in _log_exceptions#012    return function(*args, **kwargs)#012  File "/usr/libexec/xapi-storage-script/volume/org.xen.xapi.storage.xfs/SR.attach", line 205, in attach#012    set_scheduler(dbg, dev_path)#012  File "/usr/libexec/xapi-storage-script/volume/org.xen.xapi.storage.xfs/SR.attach", line 30, in set_scheduler#012    supported_scheds = get_supported_scheds(path)#012  File "/usr/libexec/xapi-storage-script/volume/org.xen.xapi.storage.xfs/SR.attach", line 40, in get_supported_scheds#012    with open(path, 'r') as file:#012FileNotFoundError: [Errno 2] No such file or directory: '/sys/block/nvme0n/queue/scheduler'

[root@xenserver-axftaywy ~]# xe sr-param-get uuid=7b2dd6cb-14ba-7d5f-33a1-da2191cbb94d param-name=PBDs
6fdeda0d-1f90-06b4-cc42-c57c1c477213

[root@xenserver-axftaywy ~]# xe pbd-param-get uuid=6fdeda0d-1f90-06b4-cc42-c57c1c477213 param-name=currently-attached
false