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

Allow passing optional SLA (Service Level Agreement)

It is important during the request to being able to specify SLA, as current,
fully random selection does not allow fine grained control of partition
selection.
parent 2835447c
......@@ -149,7 +149,7 @@ class OpenOrder(SlapDocument):
zope.interface.implements(interface.IOpenOrder)
def request(self, software_release, partition_reference,
partition_parameter_kw=None, software_type=None):
partition_parameter_kw=None, software_type=None, sla_parameter_kw=None):
if partition_parameter_kw is None:
partition_parameter_kw = {}
request_dict = {
......@@ -159,6 +159,9 @@ class OpenOrder(SlapDocument):
}
if software_type is not None:
request_dict['software_type'] = software_type
if sla_parameter_kw is not None:
request_dict['sla_parameter_xml'] = xml_marshaller.dumps(
sla_parameter_kw)
self._connection_helper.POST('/requestComputerPartition', request_dict)
xml = self._connection_helper.response.read()
software_instance = xml_marshaller.loads(xml)
......@@ -279,7 +282,8 @@ class ComputerPartition(SlapDocument):
# Computer Partition data are fetch from server shall be delayed
@_syncComputerPartitionInformation
def request(self, software_release, software_type, partition_reference,
shared=False, partition_parameter_kw=None, filter_kw=None):
shared=False, partition_parameter_kw=None, filter_kw=None,
sla_parameter_kw=None):
if partition_parameter_kw is None:
partition_parameter_kw = {}
elif not isinstance(partition_parameter_kw, dict):
......@@ -292,8 +296,7 @@ class ComputerPartition(SlapDocument):
raise ValueError("Unexpected type of filter_kw '%s'" % \
filter_kw)
self._connection_helper.POST('/requestComputerPartition',
{ 'computer_id': self._computer_id,
request_dict = { 'computer_id': self._computer_id,
'computer_partition_id': self._partition_id,
'software_release': software_release,
'software_type': software_type,
......@@ -302,7 +305,11 @@ class ComputerPartition(SlapDocument):
'partition_parameter_xml': xml_marshaller.dumps(
partition_parameter_kw),
'filter_xml': xml_marshaller.dumps(filter_kw),
})
}
if sla_parameter_kw is not None:
request_dict['sla_parameter_xml'] = xml_marshaller.dumps(
sla_parameter_kw)
self._connection_helper.POST('/requestComputerPartition', request_dict)
xml = self._connection_helper.response.read()
software_instance = xml_marshaller.loads(xml)
computer_partition = ComputerPartition(
......
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