From e12f1b9fe946d2035d8a66ba0156971ff7fd65f6 Mon Sep 17 00:00:00 2001
From: Kálmán Viktor <kviktor@cloud.bme.hu>
Date: Wed, 19 Nov 2014 16:51:01 +0100
Subject: [PATCH] occi: storagelink fixes

---
 circle/occi/occi.py                         | 6 +++---
 circle/occi/templates/occi/link.html        | 2 +-
 circle/occi/templates/occi/storagelink.html | 2 +-
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/circle/occi/occi.py b/circle/occi/occi.py
index 78d1659..547e745 100644
--- a/circle/occi/occi.py
+++ b/circle/occi/occi.py
@@ -448,7 +448,7 @@ class StorageLink(Link):
 
     def init_attrs(self, instance, disk):
         self.attrs = {}
-        self.attrs['occi.core.id'] = "vm%d_disk%d" % (instance.pk, disk.pk)
+        self.attrs['occi.core.id'] = "vm_%d_disk_%d" % (instance.pk, disk.pk)
         self.attrs['occi.core.target'] = Storage(disk).render_location()
         self.attrs['occi.core.source'] = Compute(instance).render_location()
         # deviceid? mountpoint?
@@ -715,12 +715,12 @@ LINK_KIND = Kind(
 STORAGE_LINK_ATTRS = LINK_ATTRS + [
     Attribute("occi.storagelink.deviceid"),
     Attribute("occi.storagelink.mountpoint"),
-    Attribute("occi.core.state", "immutable"),
+    Attribute("occi.storagelink.state", "immutable"),
 ]
 
 STORAGE_LINK_KIND = Kind(
     term="storagelink",
-    scheme="http://schemas.ogf.org/occi/infrastructure#",
+    scheme="http://schemas.ogf.org/occi/infrastructure#storagelink",
     class_="kind",
     title="Storage link",
     rel="http://schemas.ogf.org/occi/core#link",
diff --git a/circle/occi/templates/occi/link.html b/circle/occi/templates/occi/link.html
index 58bab1e..d122187 100644
--- a/circle/occi/templates/occi/link.html
+++ b/circle/occi/templates/occi/link.html
@@ -1,3 +1,3 @@
 {% spaceless %}
-Link: <{{ target }}>; rel="{{ kind.rel }}"; self="{{ location }}"; category="{{ kind.scheme }}storagelink"; {% for k, v in attrs.items %}{{ k }}={% if v.isdigit == False or k == "occi.core.id" %}"{{ v }}"{% else %}{{ v }}{% endif %}{% if not forloop.last %}; {% endif %}{% endfor %}
+Link: <{{ target }}>; rel="{{ kind.rel }}"; self="{{ location }}"; category="{{ kind.scheme }}"; {% for k, v in attrs.items %}{{ k }}={% if v.isdigit == False or k == "occi.core.id" %}"{{ v }}"{% else %}{{ v }}{% endif %}{% if not forloop.last %}; {% endif %}{% endfor %}
 {% endspaceless %}
diff --git a/circle/occi/templates/occi/storagelink.html b/circle/occi/templates/occi/storagelink.html
index dbda0fd..672203f 100644
--- a/circle/occi/templates/occi/storagelink.html
+++ b/circle/occi/templates/occi/storagelink.html
@@ -1,4 +1,4 @@
-Category: compute; scheme="{{ kind.scheme }}"; class="{{ kind.class }}";
+Category: storagelink; scheme="{{ kind.scheme }}"; class="{{ kind.class }}";
 {% for k, v in attrs.items %}
   X-OCCI-Attribute: {{ k }}={% if v.isdigit == False or k == "occi.core.id" %}"{{ v }}"{% else %}{{ v }}{% endif %}
 {% endfor %}
--
libgit2 0.26.0