summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJavier Sánchez Parra <jsanchez@soleta.eu>2020-09-28 16:09:38 +0200
committerOpenGnSys Support Team <soporte-og@soleta.eu>2020-09-29 12:34:05 +0200
commitb138fbc0db906f790b984ee520e9175b2ea974f2 (patch)
tree24b650e47d991da03da542bd2a12f971083d6103
parentc86eae48fedb6ab674b2def0daa4d5f709560a50 (diff)
#1004 Send datasize in bytes
Image datasize is expressed in kibibytes but the existing REST API field represent data in bytes. This commit changes ogClient to send datasize in bytes.
-rw-r--r--src/ogRest.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/ogRest.py b/src/ogRest.py
index ff9cccb..c50adfa 100644
--- a/src/ogRest.py
+++ b/src/ogRest.py
@@ -201,6 +201,9 @@ class ogThread():
ogRest.state = ThreadState.IDLE
return
+ kibi = 1024
+ datasize = int(image_info['datasize']) * kibi
+
json_body = jsonBody()
json_body.add_element('disk', request.getDisk())
json_body.add_element('partition', request.getPartition())
@@ -212,7 +215,7 @@ class ogThread():
json_body.add_element('clonator', image_info['clonator'])
json_body.add_element('compressor', image_info['compressor'])
json_body.add_element('filesystem', image_info['filesystem'])
- json_body.add_element('datasize', int(image_info['datasize']))
+ json_body.add_element('datasize', datasize)
response = restResponse(ogResponses.OK, json_body)
client.send(response.get())