Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Gyuricska Milán
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
bc42b8d6
authored
Oct 14, 2014
by
Bach Dániel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
occi: random fixes
parent
8768be4a
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
7 deletions
+10
-7
circle/occi/occi.py
+8
-5
circle/occi/templates/occi/compute.html
+2
-2
No files found.
circle/occi/occi.py
View file @
bc42b8d6
...
...
@@ -5,7 +5,7 @@ from vm.models import Instance, Lease
from
vm.models.common
import
ARCHITECTURES
from
vm.models.instance
import
ACCESS_METHODS
OCCI_ADDR
=
"http
://pc3.szgt.uni-miskolc.hu:5863
/"
OCCI_ADDR
=
"http
s://miskolc.cloud.bme.hu:12598
/"
class
Category
():
...
...
@@ -30,11 +30,13 @@ class Category():
def
render_values
(
self
):
ret
=
"
%
s;"
%
self
.
term
simple_arguments
=
[
"scheme"
,
"class"
,
"title"
,
"rel"
,
"location"
]
simple_arguments
=
[
"scheme"
,
"class"
,
"title"
,
"rel"
]
for
i
in
simple_arguments
:
if
hasattr
(
self
,
i
):
ret
+=
'
%
s="
%
s";'
%
(
i
,
getattr
(
self
,
i
))
if
hasattr
(
self
,
"location"
):
ret
+=
' location="
%
s";'
%
(
self
.
location
%
OCCI_ADDR
)
if
hasattr
(
self
,
"attributes"
):
ret
+=
' attributes="
%
s";'
%
" "
.
join
(
[
a
.
render
()
for
a
in
self
.
attributes
])
...
...
@@ -87,7 +89,7 @@ class Compute(Resource):
def
__init__
(
self
,
instance
=
None
,
attrs
=
None
,
**
kwargs
):
self
.
attrs
=
{}
if
instance
:
self
.
location
=
"
%
socci/vm/
%
d"
%
(
OCCI_ADDR
,
instance
.
pk
)
self
.
location
=
"
%
socci/vm/
%
d
/
"
%
(
OCCI_ADDR
,
instance
.
pk
)
self
.
instance
=
instance
self
.
init_attrs
()
elif
attrs
:
...
...
@@ -95,6 +97,7 @@ class Compute(Resource):
self
.
_create_object
()
translate
=
{
'occi.core.id'
:
"id"
,
'occi.compute.architecture'
:
"arch"
,
'occi.compute.cores'
:
"num_cores"
,
'occi.compute.hostname'
:
"short_hostname"
,
...
...
@@ -124,10 +127,10 @@ class Compute(Resource):
params
[
'name'
]
=
"from occi yo"
i
=
Instance
.
create
(
params
=
params
,
disks
=
[],
networks
=
[],
req_traits
=
[],
tags
=
[])
self
.
location
=
"
%
socci/vm/
%
d"
%
(
OCCI_ADDR
,
i
.
pk
)
self
.
location
=
"
%
socci/vm/
%
d
/
"
%
(
OCCI_ADDR
,
i
.
pk
)
def
render_location
(
self
):
return
"
X-OCCI-Location:
%
s"
%
self
.
location
return
"
%
s"
%
self
.
location
def
render_body
(
self
):
kind
=
COMPUTE_KIND
...
...
circle/occi/templates/occi/compute.html
View file @
bc42b8d6
Category: compute; scheme=
{{ kind.scheme }}
; class="{{ kind.class }}";
Category: compute; scheme=
"{{ kind.scheme }}"
; class="{{ kind.class }}";
{% spaceless %}
{% for k, v in attrs.items %}
X-OCCI-Attribute: {{ k }}={% if v.isdigit == False %}"{{ v }}"{% else %}{{ v }}{% endif %}{% endfor %}
X-OCCI-Attribute: {{ k }}={% if v.isdigit == False
or k == "occi.core.id"
%}"{{ v }}"{% else %}{{ v }}{% endif %}{% endfor %}
{% endspaceless %}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment