softlayer / jumpgate

A simple library to make more clouds compatible with OpenStack.
http://softlayer.github.io/jumpgate/
MIT License
46 stars 30 forks source link

not all compute servers return image json ref #145

Open bodenr opened 9 years ago

bodenr commented 9 years ago

As per the openstack compute v2 docs, a GET on /v2/​{tenant_id}​/servers/​{server_id}​ should return a server structure which (among other things) contains a sub-object for the image.

For example from http://developer.openstack.org/api-ref-compute-v2.html

        "id": "893c7791-f1df-4c3d-8383-3caae9656c62",
        "image": {
            "id": "70a599e0-31e7-49b7-b260-868f441e862b",
            "links": [
                {
                    "href": "http://openstack.example.com/openstack/images/70a599e0-31e7-49b7-b260-868f441e862b",
                    "rel": "bookmark"
                }
            ]
        },

Currently in jumpgate servers we do "try" to return this if the server was created from an image (see: https://github.com/softlayer/jumpgate/blob/master/jumpgate/compute/drivers/sl/servers.py#L621), but this case only holds if the server was created from an actual image.

As a result often a substantial amount of the servers do not have an image and thus various nova clients / consumers fail expecting to find the sub-object.

For example here: https://github.com/openstack/ceilometer/blob/master/ceilometer/nova_client.py#L99

bodenr commented 9 years ago

@sudorandom @underscorephil -- are you guys aware of any way to mitigate this issue (see description). I've been poking around, but have yet to find a solution.

Please advise.

underscorephil commented 9 years ago

@bodenr - When a VM is created without a reference image, the operating system is seen as a SoftLayer_Item_Price which does not have a GUID similar to the Block_Device_Template_Group objects. The closest thing I can think of would be the operatingSystem or operatingSystemReferenceCode properties off of SoftLayer_Virtual_Guest.

bodenr commented 9 years ago

@underscorephil thanks for the prompt response... I've been playing with the Virtual_Guest masks; in particular the softwareLicense and operatingSystemReferenceCode, snips below:

 'operatingSystemReferenceCode':'UBUNTU_14_64',
 'softwareLicense':{  
         'softwareDescription':{  
            'referenceCode':'UBUNTU_14_64',
            'version':'14.04-64 Minimal for VSI',
            'name':'Ubuntu',
            'manufacturer':'Ubuntu'
         },
         'softwareDescriptionId':1342,
         'id':1932
      },

I'm wondering if we can't generate a GUID based on the ref code to use the GUID and begin to expose these as images.

Have you or @sudorandom put any thought into this before? If so please ref me to any details which would eliminate duplicate work / efforts.

Thanks

jimlindeman commented 9 years ago

Currently our "list images" API emulation in Jumpgate does a query of public & private images. Would it then make sense for Jumpgate to list a third type of image in the listing where we describe the base OS images and perhaps generate a GUID that is a concatenation (with some prefix) of the softwareDescriptionId & 'id' fields. We could then better resolve the case described by: https://github.com/softlayer/jumpgate/blob/master/jumpgate/compute/drivers/sl/servers.py#L621