Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
17
Merge Requests
17
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
nexedi
slapos.core
Commits
7368822f
Commit
7368822f
authored
Oct 15, 2015
by
Alain Takoudjou
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'tap-nobridge' into 'master'
Tap nobridge See merge request !2
parents
0f48ce37
b8d90b26
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
566 additions
and
4 deletions
+566
-4
master/product/Vifib/Tool/SlapTool.py
master/product/Vifib/Tool/SlapTool.py
+49
-0
slapos/grid/slapgrid.py
slapos/grid/slapgrid.py
+294
-2
slapos/grid/templates/iptables-ipv4-firewall-add.in
slapos/grid/templates/iptables-ipv4-firewall-add.in
+0
-0
slapos/slap/interface/slap.py
slapos/slap/interface/slap.py
+6
-0
slapos/slap/slap.py
slapos/slap/slap.py
+9
-0
slapos/tests/slapgrid.py
slapos/tests/slapgrid.py
+208
-2
No files found.
master/product/Vifib/Tool/SlapTool.py
View file @
7368822f
...
...
@@ -272,6 +272,33 @@ class SlapTool(BaseTool):
self
.
_getSlapPartitionByPackingList
(
_assertACI
(
computer_partition
.
getObject
())))
return
xml_marshaller
.
xml_marshaller
.
dumps
(
slap_computer
)
@
UnrestrictedMethod
def
_getHostingSubscriptionIpList
(
self
,
computer_id
,
computer_partition_id
):
software_instance
=
self
.
_getSoftwareInstanceForComputerPartition
(
computer_id
,
computer_partition_id
)
if
software_instance
is
None
or
\
software_instance
.
getSlapState
()
==
'destroy_requested'
:
return
xml_marshaller
.
xml_marshaller
.
dumps
([])
# Search hosting subscription
hosting
=
software_instance
.
getSpecialiseValue
()
while
hosting
and
hosting
.
getPortalType
()
!=
"Hosting Subscription"
:
hosting
=
hosting
.
getSpecialiseValue
()
ip_address_list
=
[]
for
instance
in
hosting
.
getSpecialiseRelatedValueList
(
portal_type
=
"Software Instance"
):
computer_partition
=
instance
.
getAggregateValue
(
portal_type
=
"Computer Partition"
)
if
not
computer_partition
:
continue
for
internet_protocol_address
in
computer_partition
.
contentValues
(
portal_type
=
'Internet Protocol Address'
):
ip_address_list
.
append
(
(
internet_protocol_address
.
getNetworkInterface
(
''
).
decode
(
"UTF-8"
),
internet_protocol_address
.
getIpAddress
().
decode
(
"UTF-8"
))
)
return
xml_marshaller
.
xml_marshaller
.
dumps
(
ip_address_list
)
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getFullComputerInformation'
)
def
getFullComputerInformation
(
self
,
computer_id
):
...
...
@@ -298,6 +325,28 @@ class SlapTool(BaseTool):
else
:
return
result
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getHostingSubscriptionIpList'
)
def
getHostingSubscriptionIpList
(
self
,
computer_id
,
computer_partition_id
):
"""
Search and return all Computer Partition IP address related to one
Hosting Subscription
"""
result
=
self
.
_getHostingSubscriptionIpList
(
computer_id
,
computer_partition_id
)
if
self
.
REQUEST
.
response
.
getStatus
()
==
200
:
# Keep in cache server for 7 days
self
.
REQUEST
.
response
.
setHeader
(
'Cache-Control'
,
'public, max-age=1, stale-if-error=604800'
)
self
.
REQUEST
.
response
.
setHeader
(
'Vary'
,
'REMOTE_USER'
)
self
.
REQUEST
.
response
.
setHeader
(
'Last-Modified'
,
rfc1123_date
(
DateTime
()))
self
.
REQUEST
.
response
.
setBody
(
result
)
return
self
.
REQUEST
.
response
else
:
return
result
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getComputerPartitionCertificate'
)
def
getComputerPartitionCertificate
(
self
,
computer_id
,
computer_partition_id
):
...
...
slapos/grid/slapgrid.py
View file @
7368822f
This diff is collapsed.
Click to expand it.
slapos/grid/templates/iptables-ipv4-firewall-add.in
0 → 100644
View file @
7368822f
slapos/slap/interface/slap.py
View file @
7368822f
...
...
@@ -331,6 +331,12 @@ class IComputerPartition(IBuildoutController, IRequester):
text -- message log of the status
"""
def
getFullHostingIpAddressList
():
"""
Returns a dictionnary containing the latest status of the
computer partition.
"""
class
IComputer
(
Interface
):
"""
Computer interface specification
...
...
slapos/slap/slap.py
View file @
7368822f
...
...
@@ -606,6 +606,15 @@ class ComputerPartition(SlapRequester):
}
)
return
xml_marshaller
.
loads
(
xml
)
def
getFullHostingIpAddressList
(
self
):
xml
=
self
.
_connection_helper
.
GET
(
'getHostingSubscriptionIpList'
,
params
=
{
'computer_id'
:
self
.
_computer_id
,
'computer_partition_id'
:
self
.
_partition_id
,
}
)
return
xml_marshaller
.
loads
(
xml
)
def
_addIpv6Brackets
(
url
):
# if master_url contains an ipv6 without bracket, add it
...
...
slapos/tests/slapgrid.py
View file @
7368822f
This diff is collapsed.
Click to expand it.
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