Commit 33971c7f authored by Marcin Haba's avatar Marcin Haba
Browse files

baculum: Add dedupengine output type to status storage

parent 489d5384
......@@ -38,6 +38,7 @@ class StatusStorage extends ComponentStatusModule {
const OUTPUT_TYPE_RUNNING = 'running';
const OUTPUT_TYPE_TERMINATED = 'terminated';
const OUTPUT_TYPE_DEVICES = 'devices';
const OUTPUT_TYPE_DEDUPENGINE = 'dedupengine';
/**
* Get parsed storage status.
......@@ -78,18 +79,23 @@ class StatusStorage extends ComponentStatusModule {
$autochangers = [];
$ach_dev = [];
$empty_lines = 0;
for($i = 0; $i < count($output); $i++) {
for ($i = 0; $i < count($output); $i++) {
if (preg_match('/[\[\]]$/', $output[$i]) === 1) {
$output[$i] = '';
}
if (empty($output[$i])) {
$empty_lines++;
if (count($part) > 10) {
$result[] = $part;
$part = [];
}
if (count($ach_dev) == 2) {
$autochangers[$autochanger]['devices'][] = $ach_dev;
$ach_dev = [];
continue;
}
if (count($part) > 7) {
$result[] = $part;
$part = [];
continue;
}
if ($empty_lines == 4 && $autochanger) {
if ($empty_lines > 3 && $autochanger) {
$autochanger = null;
}
} else {
......@@ -144,7 +150,8 @@ class StatusStorage extends ComponentStatusModule {
self::OUTPUT_TYPE_HEADER,
self::OUTPUT_TYPE_RUNNING,
self::OUTPUT_TYPE_TERMINATED,
self::OUTPUT_TYPE_DEVICES
self::OUTPUT_TYPE_DEVICES,
self::OUTPUT_TYPE_DEDUPENGINE
)
);
}
......
......@@ -58,7 +58,9 @@ class StorageStatus extends ConsoleOutputPage {
$out = (object)['output' => [], 'error' => 0];
if ($out_format === parent::OUTPUT_FORMAT_RAW) {
$out = $this->getRawOutput(['storage' => $storage->name]);
$out = $this->getRawOutput([
'storage' => $storage->name
]);
} elseif ($out_format === parent::OUTPUT_FORMAT_JSON) {
$out = $this->getJSONOutput([
'storage' => $storage->name,
......
......@@ -2527,17 +2527,18 @@
{
"$ref": "#/components/parameters/StorageId"
},
{
"$ref": "#/components/parameters/Output"
},
{
"name": "type",
"in": "query",
"required": false,
"description": "Output type using together with output=json parameter.",
"schema": {
"type": "string",
"enum": ["header", "running", "devices", "terminated"]
"enum": ["header", "running", "devices", "terminated", "dedupengine"]
}
},
{
"$ref": "#/components/parameters/Output"
}
]
}
......
Supports Markdown
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