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
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
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
Klaus Wölfel
slapos.core
Commits
676f082a
Commit
676f082a
authored
Jun 13, 2012
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Do not create destroyed software instance.
parent
605ee2ea
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
65 additions
and
55 deletions
+65
-55
master/bt5/vifib_slapos_core/WorkflowTemplateItem/portal_workflow/instance_slap_interface_workflow/scripts/RequesterInstance_request.xml
..._interface_workflow/scripts/RequesterInstance_request.xml
+64
-54
master/bt5/vifib_slapos_core/bt/revision
master/bt5/vifib_slapos_core/bt/revision
+1
-1
No files found.
master/bt5/vifib_slapos_core/WorkflowTemplateItem/portal_workflow/instance_slap_interface_workflow/scripts/RequesterInstance_request.xml
View file @
676f082a
...
...
@@ -122,6 +122,10 @@ else:\n
raise ValueError, "Too many instances \'%s\' found: %s" % (software_title, [x.path for x in request_software_instance_list])\n
\n
if (request_software_instance is None):\n
if (root_state == "destroyed"):\n
instance_found = False\n
else:\n
instance_found = True\n
# First time that the software instance is requested\n
if is_slave == True:\n
software_instance_portal_type = "Slave Instance"\n
...
...
@@ -149,6 +153,7 @@ if (request_software_instance is None):\n
graph[request_software_instance.getUid()] = []\n
\n
else:\n
instance_found = True\n
# Update the predecessor category of the previous requester\n
predecessor = request_software_instance.getPredecessorRelatedValue(portal_type="Software Instance")\n
if (predecessor is None):\n
...
...
@@ -161,41 +166,46 @@ else:\n
predecessor.edit(predecessor_uid_list=predecessor_uid_list)\n
graph[predecessor.getUid()] = predecessor_uid_list\n
\n
# Change desired state\n
promise_kw = {\n
if instance_found:\n
\n
# Change desired state\n
promise_kw = {\n
\'instance_xml\': instance_xml,\n
\'software_type\': software_type,\n
\'sla_xml\': sla_xml,\n
\'software_release\': software_release_url_string,\n
\'shared\': is_slave,\n
}\n
request_software_instance_url = request_software_instance.getRelativeUrl()\n
context.REQUEST.set(\'request_instance\', request_software_instance)\n
if (root_state == "started"):\n
}\n
request_software_instance_url = request_software_instance.getRelativeUrl()\n
context.REQUEST.set(\'request_instance\', request_software_instance)\n
if (root_state == "started"):\n
request_software_instance.requestStart(**promise_kw)\n
elif (root_state == "stopped"):\n
elif (root_state == "stopped"):\n
request_software_instance.requestStop(**promise_kw)\n
elif (root_state == "destroyed"):\n
elif (root_state == "destroyed"):\n
request_software_instance.requestDestroy(**promise_kw)\n
context.REQUEST.set(\'request_instance\', None)\n
else:\n
else:\n
raise ValueError, "state should be started, stopped or destroyed"\n
\n
predecessor_list = requester_instance.getPredecessorList() + [request_software_instance_url]\n
uniq_predecessor_list = list(set(predecessor_list))\n
predecessor_list.sort()\n
uniq_predecessor_list.sort()\n
predecessor_list = requester_instance.getPredecessorList() + [request_software_instance_url]\n
uniq_predecessor_list = list(set(predecessor_list))\n
predecessor_list.sort()\n
uniq_predecessor_list.sort()\n
\n
assert predecessor_list == uniq_predecessor_list, "%s != %s" % (predecessor_list, uniq_predecessor_list)\n
assert predecessor_list == uniq_predecessor_list, "%s != %s" % (predecessor_list, uniq_predecessor_list)\n
\n
# update graph to reflect requested operation\n
graph[requester_instance.getUid()] = requester_instance.getPredecessorUidList() + [request_software_instance.getUid()]\n
# update graph to reflect requested operation\n
graph[requester_instance.getUid()] = requester_instance.getPredecessorUidList() + [request_software_instance.getUid()]\n
\n
# check if all elements are still connected and if there is no cycle\n
request_software_instance.checkConnected(graph, hosting_subscription.getUid())\n
request_software_instance.checkNotCyclic(graph)\n
# check if all elements are still connected and if there is no cycle\n
request_software_instance.checkConnected(graph, hosting_subscription.getUid())\n
request_software_instance.checkNotCyclic(graph)\n
\n
requester_instance.edit(predecessor_list=predecessor_list)\n
requester_instance.edit(predecessor_list=predecessor_list)\n
\n
else:\n
context.REQUEST.set(\'request_instance\', None)\n
]]>
</string>
</value>
...
...
master/bt5/vifib_slapos_core/bt/revision
View file @
676f082a
39
\ No newline at end of file
40
\ No newline at end of file
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