tmetsch / occi-os

This is a clone and continuation of https://github.com/dizz/nova - it provides a python egg which can be easily deployed in OpenStack and will thereby add the 3rd party OCCI interface to OpenStack. For usage examples, see the OpenStack wiki.
Apache License 2.0
10 stars 23 forks source link

Category names contain spaces for images #32

Closed bhagemeier closed 11 years ago

bhagemeier commented 11 years ago

Hi there,

when querying resources on a system, the image categories can contain spaces in them. For example:

Category: OpenSuSE 12.1 Minimal; scheme="http://schemas.openstack.org/template/os#"; class="mixin"; title="This is an OS OpenSuSE 12.1 Minimal VM image"; rel="http://schemas.ogf.org/occi/infrastructure#os_tpl"; location="https://myhost.mydomain:1234/OpenSuSE 12.1 Minimal/"

Should encoding be used to avoid these spaces? They don't seem to comply with the specification.

Best regards, Björn

dizz commented 11 years ago

Quickly thinking, it'd make sense to replace spaces with an underscore for the term & location values. For other values (title) the space can remain. Certainly needs a change as it is. Other thoughts/opinions?

tmetsch commented 11 years ago

Seems like the fix should go here: https://github.com/tmetsch/occi-os/blob/stable/folsom/occi_os_api/wsgi.py#L175

alvarolopez commented 11 years ago

Shouldn't the Category be the uuid of the image? One can have several images with the very same name (i.e. "OpenSuSE 12.1 Minimal"), but with different ids.

dizz commented 11 years ago

No - the mixin only points to a image that can be instantiated. An image should be a unique template (collection of software). The UUID would be better associated with the VM as it is in the OCCI-OS implementation, where there are multiple VM instances of the same image.

bhagemeier commented 11 years ago

Hi,

from my point of view, images as well as VMs can have UUIDs. And like Álvaro says, I can easily imaging (just done it a minute ago) multiple distinct images with the same name (bad idea, I know).

Cheers, Björn

On 04.03.2013 14:36, Andy Edmonds wrote :

No - the mixin only points to a image that can be instantiated. An image should be a unique template (collection of software). The UUID would be better associated with the VM as it is in the OCCI-OS implementation, where there are multiple VM instances of the same image.

— Reply to this email directly or view it on GitHub https://github.com/tmetsch/occi-os/issues/32#issuecomment-14380868.

Dipl.-Inform. Björn Hagemeier Federated Systems and Data Juelich Supercomputing Centre Institute for Advanced Simulation

Phone: +49 2461 61 1584 Fax : +49 2461 61 6656 Email: b.hagemeier@fz-juelich.de Skype: bhagemeier WWW : http://www.fz-juelich.de/jsc

JSC is the coordinator of the John von Neumann Institute for Computing and member of the Gauss Centre for Supercomputing



Forschungszentrum Juelich GmbH 52425 Juelich Sitz der Gesellschaft: Juelich Eingetragen im Handelsregister des Amtsgerichts Dueren Nr. HR B 3498 Vorsitzender des Aufsichtsrats: MinDir Dr. Karl Eugen Huthmacher Geschaeftsfuehrung: Prof. Dr. Achim Bachem (Vorsitzender), Karsten Beneke (stellv. Vorsitzender), Prof. Dr.-Ing. Harald Bolt,

Prof. Dr. Sebastian M. Schmidt


alvarolopez commented 11 years ago

Images do have UUIDs (the glance's id column). Consider the following real example from our glance installation:

+--------------------------------------+----------------------------------------------+--------+--------------------------------------+
| ID                                   | Name                                         | Status | Server                               |
+--------------------------------------+----------------------------------------------+--------+--------------------------------------+
| 486c139e-f34d-465c-959c-1b9c8bf60cfd | Ubuntu Server 10.04 JeOS                     | ACTIVE |                                      |
| 694f2673-7ea3-4690-a25e-c9dd4297519a | Ubuntu Server 10.04 JeOS                     | ACTIVE |                                      |
+--------------------------------------+----------------------------------------------+--------+--------------------------------------+

These are two different images with the same name. Even though I think that it is not correct to have different images with the same global name, this could happen (as in the example) when users upload their own images, that's why the only unique key is the image's uuid.

dizz commented 11 years ago

Fair point. I guess my initial reaction was one based on the fear of people confabulating occi.core.id and Category's term value. So long as they're not seen as the same then it's all gravy! :-)

arax commented 11 years ago

I'm not familiar with OS, please excuse any misconceptions, I will call a physical file containing filesystem(s) an image and a collection of resources (this collection can be instantiated) a VM template.

Does infrastructure#os_tpl in OCCI-OS represent a VM template or a disk image? If it represents a VM template then the point made by @alvarolopez relates more to infrastructure#storage although I'm sure that VM templates in OS follow similar naming conventions.

I think that removing spaces from Category terms is a good place to start.

dizz commented 11 years ago

infrasructure#os_tpl is a VM template where os == operating system and tpl == template

arax commented 11 years ago

Ok, I thought as much, I just needed to be sure.

As the discussion goes on we are starting to mix storage with os_tpl and the initial point of this issue is getting lost. So here is my attempt to get things back on track:

"Category names contain spaces for images" should really be "Category terms contain spaces for os_tpl(s)" and it is about invalid terms in HTTP rendering breaking OCCI-OS' compatibility with rOCCI client.

GFD.185 – OCCI HTTP Rendering (v1.1) says the following: term = LOALPHA *( LOALPHA | DIGIT | "-" | "_" )

dizz commented 11 years ago

Ok a 2 min fix. I've it now in the right place (wsgi.py).

>>> name = "my name should not have spaces "
>>> name
'my name should not have spaces '
>>> name.strip().replace(' ', '_')
'my_name_should_not_have_spaces'
>>>
arax commented 11 years ago

Thank you very much :+1:

dizz commented 11 years ago

I'm always happy to take payment in beer :-D

arax commented 11 years ago

If we get a chance to meet in person at some event in the near future, I will be happy to settle this debt :-)

dizz commented 11 years ago

Your on! :-)