Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
python-distem
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
myriads-team
python-distem
Commits
5f6e4cbd
Verified
Commit
5f6e4cbd
authored
Aug 20, 2019
by
SIMONIN Matthieu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add some logging
parent
8ad5c373
Pipeline
#90271
passed with stages
in 1 minute and 58 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
19 deletions
+21
-19
distem/__init__.py
distem/__init__.py
+21
-19
No files found.
distem/__init__.py
View file @
5f6e4cbd
import
json
import
copy
import
logging
import
requests
class
Distem
:
def
__init__
(
self
,
serveraddr
=
"localhost"
,
port
=
4567
):
def
__init__
(
self
,
*
,
serveraddr
=
"localhost"
,
port
=
4567
):
self
.
serveraddr
=
serveraddr
self
.
port
=
port
self
.
client
=
requests
.
Session
()
...
...
@@ -15,10 +16,10 @@ class Distem:
Args:
name
(str)
The name of the virtual network (unique) address(str) The
addres
s (CIDR format: 10.0.8.0/24) the virtual network will work
with options(dict)
used to store vxlan_id and number of PNODES
(should not be used directly)
name
(str):
The name of the virtual network (unique) address(str) The
addres
(str): address in CIDR format (e.g 10.0.8.0/24)
opts (dict):
used to store vxlan_id and number of PNODES
(should not be used directly)
Returns:
{dict} The virtual network description
...
...
@@ -119,31 +120,30 @@ class Distem:
return
self
.
post_json
(
"/vnodes/%s"
%
(
name
),
data
=
data
)
def
vnode_start
(
self
,
vnodename
):
"""
Start a virtual node.
def
vnode_start
(
self
,
vnodename
,
*
,
async
=
False
):
"""Start a virtual node.
A physical node (that have enought
physical resources (CPU,...))
will be automatically allocated if there is none set as +host+ at
the moment The filesystem archive will be copied on the hosting
physical node. A filesystem image *must* have been set (see
{#vnode_create} or {#vfilesystem_create}/{#vfilesystem_update}).
A physical node (that have enough
physical resources (CPU,...))
will be automatically allocated if there is none set as +host+ at
the moment The filesystem archive will be copied on the hosting
physical node. A filesystem image *must* have been set (see
{#vnode_create} or {#vfilesystem_create}/{#vfilesystem_update}).
Args:
vnodename
(str)
The name of the virtual node
async
(Boolean)
Asynchronious mode, check virtual node status to know
when node is configured (see {#vnode_info})
vnodename
(str):
The name of the virtual node
async
(bool):
Asynchronious mode, check virtual node status to know
when node is configured (see {#vnode_info})
Returns:
{dict} T
he virtual node description
dict of t
he virtual node description
see :desc:`resources description<>`
"""
desc
=
{
"desc"
:
{
"name"
:
str
(
vnodename
),
"status"
:
"RUNNING"
},
"type"
:
"update"
,
"async"
:
False
,
"async"
:
async
,
}
return
self
.
put_json
(
"/vnodes/%s"
%
(
str
(
vnodename
)),
data
=
desc
)
...
...
@@ -786,6 +786,7 @@ class Distem:
)
def
raw_request
(
self
,
method
,
route
,
data
):
logging
.
debug
(
"method=%s, route=%s, data=%s"
,
method
,
route
,
data
)
result
=
""
_data
=
copy
.
deepcopy
(
data
)
for
key
,
value
in
data
.
items
():
...
...
@@ -803,4 +804,5 @@ class Distem:
result
=
response
.
text
return
result
else
:
raise
Exception
(
response
.
headers
[
"X-Application-Error-Code"
])
err
=
response
.
headers
.
get
(
"X-Application-Error-Code"
,
"Unknown error"
)
raise
Exception
(
err
)
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