lxd icon indicating copy to clipboard operation
lxd copied to clipboard

Multi-architecture aliases

Open jwh opened this issue 5 years ago • 5 comments

(If this would be better suited to discourse please close)

I've been looking at a way to be able to reference one alias regardless of platform but that doesn't seem to be doable - would it be feasible to introduce as a feature? something like:

  • Images imported as my/test/image/amd64 and my/test/image/aarch64 with alias my/test/image/latest (or even just my/test/image)
  • An lxc launch is able to pick the correct one based on the arch (perhaps an extra flag during the import above?)

Similar in principle to multi arch docker manifests but I'm not sure how feasible it would be to implement here.

Thanks!

jwh avatar Feb 14 '20 12:02 jwh

So this is something I considered when working on some of the multi-architecture clustering bits. It does work with simplestreams which is why ubuntu:18.04 for example gets you the right architecture every time.

But for it to work with the LXD protocol itself, it's a bit harder. The main issue is that we have URLs like /1.0/image/aliases/name-of-alias which would now be able to point to multiple different images depending on the architecture. We also would need a way to retrieve the list of all architectures supported for a given alias. There also would likely be some consideration to keep in mind around private images as for those, we don't have LXD lookup the alias, instead leaving that to the client.

I "think" a backward compatible implementation of this in LXD would be:

  • Extend images_aliases DB table to add a new architecture INTEGER NOT NULL column
  • Alter INDEX on images_aliases to require UNIQUE be name+architecture
  • Extend api.ImageAliasesEntry to include Architecture string
  • Update /1.0/images/aliases API to populate the Architecture field (and check ?recursion=1 shows everything)
  • Add a new /1.0/images/aliases/NAME?architecture=NAME endpoint to query a particular architecture, if not specified and more than one match, prefer the native architecture
  • Add a new /1.0/images/aliases/NAME?architecture=all endpoint to get all the targets in one shot
  • Update client package for GetImageAliasArchitectures in lxd
  • Quite possibly have to update the other GetImageAlias* functions to behave the same way as they do in simplestreams
  • Add relevant API extension string for feature detection

stgraber avatar Feb 14 '20 15:02 stgraber

ahhh I didn't realise thats how simplestreams works... I should probably try that instead of the lxd protocol - have put it off so far as theres nothing really 'ready to run' but it shouldn't be that difficult to do I guess

jwh avatar Feb 14 '20 17:02 jwh

Yeah, it's effectively just two json files on an https web server, pretty easy to generate and run. I think some people wrote their own tooling around it for that though.

stgraber avatar Feb 14 '20 19:02 stgraber

Hi, I'm Pranav and I'm working with a group of computer science students at UT Austin in a Virtualization course. Can we tentatively be assigned this issue?

vpranav5 avatar Sep 20 '20 19:09 vpranav5

@vpranav5 I'd probably recommend looking at a different issue as this one is currently tagged "Maybe" which indicates we haven't quite made up our mind on whether we think this change should be done or not :)

stgraber avatar Sep 20 '20 19:09 stgraber