Commit 472f13f0 authored by Marco Mariani's avatar Marco Mariani

allow change of 'requested_state'

parent 00de2d1b
--version:9
--version:10
CREATE TABLE IF NOT EXISTS software%(version)s (url VARCHAR(255) UNIQUE);
CREATE TABLE IF NOT EXISTS computer%(version)s (
address VARCHAR(255),
......@@ -14,7 +14,8 @@ CREATE TABLE IF NOT EXISTS partition%(version)s (
slave_instance_list TEXT,
software_type VARCHAR(255),
partition_reference VARCHAR(255),
requested_by VARCHAR(255)
requested_by VARCHAR(255),
requested_state VARCHAR(255) NOT NULL DEFAULT 'started'
);
CREATE TABLE IF NOT EXISTS slave%(version)s (
......
......@@ -78,7 +78,7 @@ def partitiondict2partition(partition):
if partition['software_release']:
slap_partition._need_modification = 1
slap_partition._requested_state = 'started'
slap_partition._requested_state = partition['requested_state']
slap_partition._parameter_dict = xml2dict(partition['xml'])
address_list = []
for address in execute_db('partition_network',
......@@ -290,6 +290,7 @@ def request_not_shared():
partition_reference = request.form.get('partition_reference', '').encode()
partition_id = request.form.get('computer_partition_id', '').encode()
partition_parameter_kw = request.form.get('partition_parameter_xml', None)
requested_state = xml_marshaller.xml_marshaller.loads(request.form.get('state'))
if partition_parameter_kw:
partition_parameter_kw = xml_marshaller.xml_marshaller.loads(
partition_parameter_kw.encode())
......@@ -315,6 +316,10 @@ def request_not_shared():
a = args.append
q = 'UPDATE %s SET slap_state="busy"'
if requested_state:
q += ', requested_state=?'
a(requested_state)
# If partition doesn't exist: create it and insert parameters
if partition is None:
partition = execute_db('partition',
......
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