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
Thomas Gambier
slapos.core
Commits
28df85c3
Commit
28df85c3
authored
Jun 20, 2011
by
Gabriel Monnerat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor code to alocate one Slave Instance in Computer Partition with state busy.
parent
c6bafb4a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
8 deletions
+11
-8
master/bt5/vifib_open_trade/WorkflowTemplateItem/portal_workflow/vifib_open_order_interaction_workflow/scripts/Delivery_assignComputerPartition.xml
...ion_workflow/scripts/Delivery_assignComputerPartition.xml
+10
-7
master/bt5/vifib_open_trade/bt/revision
master/bt5/vifib_open_trade/bt/revision
+1
-1
No files found.
master/bt5/vifib_open_trade/WorkflowTemplateItem/portal_workflow/vifib_open_order_interaction_workflow/scripts/Delivery_assignComputerPartition.xml
View file @
28df85c3
...
...
@@ -56,22 +56,24 @@ portal = order.getPortalObject()\n
setup_service_relative_url = order.portal_preferences.getPreferredInstanceSetupResource()\n
isTransitionPossible = portal.portal_workflow.isTransitionPossible\n
\n
instance_portal_type_list = ["Software Instance","Slave Instance"]\n
for order_line in order.getMovementList():\n
if order_line.getResource() == setup_service_relative_url:\n
computer_partition = order_line.getAggregateValue(portal_type="Computer Partition")\n
if computer_partition is None:\n
software_release = order_line.getAggregateValue(portal_type="Software Release")\n
software_instance = order_line.getAggregateValue(portal_type=
"Software Instance"
)\n
software_instance = order_line.getAggregateValue(portal_type=
instance_portal_type_list
)\n
\n
computer_partition = None\n
\n
# XXX Duplicated from request method...\n
query_kw = {\n
\'software_release_url\': software_release.getUrlString(),\n
\'portal_type\': \'Computer Partition\',\n
# \'relative_url\': \'computer_module/20110126-E2AE/%\',\n
\'free_for_request\': 1,\n
}\n
if software_instance.getPortalType() == "Slave Instance":\n
query_kw[\'free_for_request\'] = 0\n
\n
# support SLA\n
filter_kw = software_instance.getSlaXmlAsDict()\n
if "computer_guid" in filter_kw:\n
...
...
@@ -82,18 +84,19 @@ for order_line in order.getMovementList():\n
\n
for computer_partition_candidate in portal.portal_catalog(\n
limit=(random.randint(0, offset), 50), **query_kw):\n
computer_partition_candidate = computer_partition_candidate.getObject()\n
computer_partition_candidate = computer_partition_candidate.getObject()
\n
# Check if the computer partition can be marked as busy (done by an interaction workflow on sale packing list level)\n
if isTransitionPossible(computer_partition_candidate, \'mark_busy\'):\n
if isTransitionPossible(computer_partition_candidate, \'mark_busy\')
or software_instance.getPortalType() == "Slave Instance"
:\n
computer_partition = computer_partition_candidate\n
break\n
break
\n
\n
if computer_partition is None:\n
raise ValueError(\'It was not possible to find free Computer Partition\')\n
\n
# lock computer partition\n
computer_partition.serialize()\n
computer_partition.markBusy()\n
if isTransitionPossible(computer_partition_candidate, \'mark_busy\'):\n
computer_partition.markBusy()\n
\n
order_line.edit(\n
aggregate_list=order_line.getAggregateList()+[computer_partition.getRelativeUrl()])\n
...
...
master/bt5/vifib_open_trade/bt/revision
View file @
28df85c3
88
\ No newline at end of file
89
\ 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