Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
cc-node
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Mirror
cc-node
Commits
d76cda50
Commit
d76cda50
authored
9 years ago
by
Antoine Millet
Browse files
Options
Downloads
Patches
Plain Diff
Implemented vmspec format in vm_define handler
parent
a16b7ca6
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
cloudcontrol/node/config.py
+4
-0
4 additions, 0 deletions
cloudcontrol/node/config.py
cloudcontrol/node/hypervisor/__init__.py
+21
-0
21 additions, 0 deletions
cloudcontrol/node/hypervisor/__init__.py
with
25 additions
and
0 deletions
cloudcontrol/node/config.py
+
4
−
0
View file @
d76cda50
...
...
@@ -104,6 +104,10 @@ class NodeConfigParser(object):
self
.
plugins_store_path
=
config
.
get
(
'
node
'
,
'
plugins_store_path
'
,
'
/var/lib/cc-node/plugins
'
)
# Path to define script
default_define_script
=
'
hkvm-define
'
self
.
define_script
=
config
.
get
(
'
node
'
,
'
define_script
'
,
default_define_script
)
# RPC handler ACLs
acl_section_name
=
'
node_handler
'
if
config
.
has_section
(
acl_section_name
):
...
...
This diff is collapsed.
Click to expand it.
cloudcontrol/node/hypervisor/__init__.py
+
21
−
0
View file @
d76cda50
...
...
@@ -16,6 +16,7 @@
import
logging
import
socket
import
json
from
StringIO
import
StringIO
from
xml.etree
import
cElementTree
as
et
...
...
@@ -37,6 +38,7 @@ from cloudcontrol.node.exc import (
from
cloudcontrol.node.hypervisor.jobs
import
(
ImportVolume
,
ExportVolume
,
TCPTunnel
,
DRBD
,
)
from
cloudcontrol.node.utils
import
execute
logger
=
logging
.
getLogger
(
__name__
)
...
...
@@ -202,6 +204,25 @@ class Handler(HostHandler):
if
format
==
'
xml
'
:
return
self
.
hypervisor
.
vm_define
(
data
)
elif
format
==
'
vmspec
'
:
# Encode tags as description:
if
'
tags
'
in
data
:
if
'
description
'
not
in
data
:
data
[
'
description
'
]
=
''
for
tag
,
value
in
data
[
'
tags
'
].
iteritems
():
data
[
'
description
'
]
+=
'
\n
@%s=%s
'
%
(
tag
,
value
)
# Delete the tags key which is not recognized by hkvm-define
try
:
del
data
[
'
tags
'
]
except
KeyError
:
pass
rcode
,
output
=
execute
(
self
.
main
,
[
self
.
main
.
config
.
define_script
],
stdin
=
json
.
dumps
(
data
))
if
rcode
==
0
:
return
output
.
strip
()
else
:
raise
RuntimeError
(
output
.
strip
().
split
(
'
\n
'
)[
-
1
].
strip
())
else
:
raise
NotImplementedError
(
'
Format not supported
'
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment