xapi-project / xapi-storage-script

A xapi storage adapter that calls out to scripts, one script per operation
Other
6 stars 16 forks source link

datapath.Attach fails requiring XenDisk #82

Open rck opened 5 years ago

rck commented 5 years ago

I'm working on a SR, volume, datapath plugin for API version v5 that integrates LINSTOR/DRBD. Things look promising, I got a SR in xencenter and the functions I can test for the volume/datapath plugin on the CLI look good. This is developed on xenserver 7.6.0.

Unfortunately, if I create a VM in the GUI (and it also then happens on shutdown), I geht this error:

nplug 7a8cfbb7-4271-d563-22f7-5dede0e53843.xvda
Feb  6 14:20:43 xenserver-210 xenopsd-xc: [debug|localhost.localdomain|37 |Parallel:task=251.atoms=2.(VBD.unplug vm=7a8cfbb7-4271-d563-22f7-5dede0e53843)|xenops_server] VBD_D
B.signal 7a8cfbb7-4271-d563-22f7-5dede0e53843.xvda
Feb  6 14:20:43 xenserver-210 xenopsd-xc: [error|localhost.localdomain|37 |Parallel:task=251.atoms=2.(VBD.unplug vm=7a8cfbb7-4271-d563-22f7-5dede0e53843)|task_server] Task 25
3 failed; Xenops_interface.Internal_error("Could not find XenDisk implementation: {\"implementations\":[[\"BlockDevice\",{\"path\":\"/dev/drbd1001\"}]]}")
Feb  6 14:20:43 xenserver-210 xenopsd-xc: [debug|localhost.localdomain|37 ||xenops_server] TASK.signal 253 = ["Failed",["Internal_error","Could not find XenDisk implementatio
n: {\"implementations\":[[\"BlockDevice\",{\"path\":\"/dev/drbd1001\"}]]}"]]

datapath.Attach returns this kind of dictionary:

{"implementations":[["BlockDevice",{"path":"/dev/drbd1001"}]]}

This nicely passes the type checks in /usr/lib/python2.7/site-packages/xapi/storage/api/v5/datapath.py but then fails somewhere down the road. The block device exists and is accessible on the machine. Yeah, I don't want to implement a "XenDisk", DRBD operates on block devices. Is this a bug or did I misunderstand something? "implementations" is a "variant" type, mine is "BlockDevice|. What is wrong with that?

Any hints? Best, rck

gaborigloi commented 5 years ago

Hi @rck, I think with the current implementation it might be possible to attach the VDI to dom0, but you need to return a XenDisk as well to be able to plug the VDI into a VM. For this you can start a qemu-dp process, from that you can return a XenDisk and a Nbd. You can find a existing implementation here: https://github.com/rposudnevskiy/xcpng-storage-libs/blob/master/xapi/storage/libs/xcpng/datapath.py , I don't know whether this implementation works, but looks roughly ok, I haven't tried it. (Or you can look at the existing datapath plugins installed on XenServer)

rck commented 5 years ago

Thank you for the hint, but what you linked is "xcpng", I use the original one. And when I there compare for example the implementation of qemudisk.py, they are completely different. Mine on xenserver has a different interface and lots of "fixmes" and "would not work with raw devices",... So should I backport these libs?

@gaborigloi Actually, I think this issue should stay open, if returning a block device is not good enough and a plugin implementer has to go down the rabbit hole of XenDisks, qemu-dp, nbd, something is broken in the plugin system. This could be a tracking ticket for that.

gaborigloi commented 5 years ago

I thought that xcp-ng code could be a starting point - you could take the datapath plugin and adapt it to your needs, if the license permits that. Writing a datapath plugin definitely requires XenServer knowledge. But it's true that the documentation could mention that XenDisk must be returned for attaching to VMs. So I'll keep this open as a documentation issue.