Commit b0cc3034 authored by Łukasz Nowak's avatar Łukasz Nowak

Make sync/async start/stop request.

Do not try to request start not fully installed computer partition, and wait
until instance setup packing list is stopped, before trying to create hosting
one.

Beside of setting state on Software instance by start/stop requested methods
setup in activities real request. Thanks to this *after* computer partition is
installed (instance setup packing list == stopped) the request becomes
synchronous (...a bit later -- in sense -- just once called).
parent b2447087
...@@ -132,12 +132,15 @@ else:\n ...@@ -132,12 +132,15 @@ else:\n
activate_kw={\'tag\': tag},)\n activate_kw={\'tag\': tag},)\n
if state == \'started\':\n if state == \'started\':\n
request_software_instance.startRequested()\n request_software_instance.startRequested()\n
request_software_instance.activate(after_tag=tag).requestStartComputerPartition()\n
elif state == \'stopped\':\n elif state == \'stopped\':\n
request_software_instance.stopRequested()\n request_software_instance.stopRequested() \n
request_software_instance.activate(after_tag=tag).requestStopComputerPartition()\n
else:\n else:\n
raise ValueError(\'State %r is not supported\' % state)\n raise ValueError(\'State %r is not supported\' % state)\n
\n
predecessor_list = software_instance.getPredecessorList() + [request_software_instance.getRelativeUrl()]\n predecessor_list = software_instance.getPredecessorList() + [request_software_instance.getRelativeUrl()]\n
\n
\n
software_instance.edit(\n software_instance.edit(\n
predecessor_list=predecessor_list,\n predecessor_list=predecessor_list,\n
activate_kw={\'tag\': tag},)\n activate_kw={\'tag\': tag},)\n
......
...@@ -56,14 +56,22 @@ software_instance = state_change[\'object\']\n ...@@ -56,14 +56,22 @@ software_instance = state_change[\'object\']\n
service_relative_url = software_instance.portal_preferences.\\\n service_relative_url = software_instance.portal_preferences.\\\n
getPreferredInstanceHostingResource()\n getPreferredInstanceHostingResource()\n
need_to_create_packing_list = False\n need_to_create_packing_list = False\n
\n
try:\n try:\n
sale_packing_list_line = context.SoftwareInstance_getInstanceHostingPackingListLine(state_change)\n instance_setup_line = context.SoftwareInstance_getInstanceSetupPackingListLine(state_change)\n
except ValueError:\n except ValueError:\n
need_to_create_packing_list = True\n pass\n
else:\n else:\n
if sale_packing_list_line.getSimulationState() == \'delivered\':\n if instance_setup_line.getSimulationState() == \'stopped\':\n
need_to_create_packing_list = True\n try:\n
sale_packing_list_line = context.SoftwareInstance_getInstanceHostingPackingListLine(state_change)\n
except ValueError:\n
need_to_create_packing_list = True\n
else:\n
if sale_packing_list_line.getSimulationState() == \'stopped\':\n
# previously it was still in stop in progress state, now it shall be started again\n
sale_packing_list_line.getParentValue().deliver()\n
if sale_packing_list_line.getSimulationState() == \'delivered\':\n
need_to_create_packing_list = True\n
\n \n
portal = context.getPortalObject()\n portal = context.getPortalObject()\n
if need_to_create_packing_list:\n if need_to_create_packing_list:\n
......
244 245
\ No newline at end of file \ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment