mirror of
https://github.com/akuker/RASCSI.git
synced 2025-02-07 06:30:40 +00:00
scsictl: Create files with binary/JSON or text format protobuf data (#1369)
This commit is contained in:
parent
287b9d7623
commit
abc5c4b9ac
@ -1,11 +1,12 @@
|
|||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// SCSI Target Emulator PiSCSI
|
// SCSI Target Emulator PiSCSI
|
||||||
// for Raspberry Pi
|
// for Raspberry Pi
|
||||||
//
|
//
|
||||||
// Powered by XM6 TypeG Technology.
|
// Powered by XM6 TypeG Technology.
|
||||||
// Copyright (C) 2016-2020 GIMONS
|
// Copyright (C) 2016-2020 GIMONS
|
||||||
// Copyright (C) 2020-2023 Contributors to the PiSCSI project
|
// Copyright (C) 2020-2023 Contributors to the PiSCSI project
|
||||||
|
// Copyright (C) 2021-2023 Uwe Seimet
|
||||||
//
|
//
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
@ -18,11 +19,16 @@
|
|||||||
#include "scsictl/scsictl_parser.h"
|
#include "scsictl/scsictl_parser.h"
|
||||||
#include "scsictl/scsictl_commands.h"
|
#include "scsictl/scsictl_commands.h"
|
||||||
#include "scsictl/scsictl_core.h"
|
#include "scsictl/scsictl_core.h"
|
||||||
|
#include <google/protobuf/util/json_util.h>
|
||||||
|
#include <google/protobuf/text_format.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <clocale>
|
#include <clocale>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
#include <fstream>
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
using namespace google::protobuf;
|
||||||
|
using namespace google::protobuf::util;
|
||||||
using namespace piscsi_interface;
|
using namespace piscsi_interface;
|
||||||
using namespace piscsi_util;
|
using namespace piscsi_util;
|
||||||
using namespace protobuf_util;
|
using namespace protobuf_util;
|
||||||
@ -33,8 +39,8 @@ void ScsiCtl::Banner(const vector<char *>& args) const
|
|||||||
cout << piscsi_util::Banner("(Controller App)")
|
cout << piscsi_util::Banner("(Controller App)")
|
||||||
<< "\nUsage: " << args[0] << " -i ID[:LUN] [-c CMD] [-C FILE] [-t TYPE] [-b BLOCK_SIZE] [-n NAME] [-f FILE|PARAM] "
|
<< "\nUsage: " << args[0] << " -i ID[:LUN] [-c CMD] [-C FILE] [-t TYPE] [-b BLOCK_SIZE] [-n NAME] [-f FILE|PARAM] "
|
||||||
<< "[-F IMAGE_FOLDER] [-L LOG_LEVEL] [-h HOST] [-p PORT] [-r RESERVED_IDS] "
|
<< "[-F IMAGE_FOLDER] [-L LOG_LEVEL] [-h HOST] [-p PORT] [-r RESERVED_IDS] "
|
||||||
<< "[-C FILENAME:FILESIZE] [-d FILENAME] [-w FILENAME] [-R CURRENT_NAME:NEW_NAME] "
|
<< "[-C FILENAME:FILESIZE] [-d FILENAME] [-B FILENAME] [-J FILENAME] [-T FILENAME] [-R CURRENT_NAME:NEW_NAME] "
|
||||||
<< "[-x CURRENT_NAME:NEW_NAME] [-z LOCALE] "
|
<< "[-x CURRENT_NAME:NEW_NAME] [-z LOCALE] "
|
||||||
<< "[-e] [-E FILENAME] [-D] [-I] [-l] [-m] [o] [-O] [-P] [-s] [-S] [-v] [-V] [-y] [-X]\n"
|
<< "[-e] [-E FILENAME] [-D] [-I] [-l] [-m] [o] [-O] [-P] [-s] [-S] [-v] [-V] [-y] [-X]\n"
|
||||||
<< " where ID[:LUN] ID := {0-" << (ControllerManager::GetScsiIdMax() - 1) << "},"
|
<< " where ID[:LUN] ID := {0-" << (ControllerManager::GetScsiIdMax() - 1) << "},"
|
||||||
<< " LUN := {0-" << (ControllerManager::GetScsiLunMax() - 1) << "}, default is 0\n"
|
<< " LUN := {0-" << (ControllerManager::GetScsiLunMax() - 1) << "}, default is 0\n"
|
||||||
@ -66,7 +72,7 @@ int ScsiCtl::run(const vector<char *>& args) const
|
|||||||
PbCommand command;
|
PbCommand command;
|
||||||
PbDeviceDefinition* device = command.add_devices();
|
PbDeviceDefinition* device = command.add_devices();
|
||||||
device->set_id(-1);
|
device->set_id(-1);
|
||||||
const char *hostname = "localhost";
|
string hostname = "localhost";
|
||||||
int port = 6868;
|
int port = 6868;
|
||||||
string param;
|
string param;
|
||||||
string log_level;
|
string log_level;
|
||||||
@ -74,7 +80,10 @@ int ScsiCtl::run(const vector<char *>& args) const
|
|||||||
string reserved_ids;
|
string reserved_ids;
|
||||||
string image_params;
|
string image_params;
|
||||||
string filename;
|
string filename;
|
||||||
string token;
|
string filename_json;
|
||||||
|
string filename_binary;
|
||||||
|
string filename_text;
|
||||||
|
string token;
|
||||||
bool list = false;
|
bool list = false;
|
||||||
|
|
||||||
string locale = GetLocale();
|
string locale = GetLocale();
|
||||||
@ -82,186 +91,228 @@ int ScsiCtl::run(const vector<char *>& args) const
|
|||||||
opterr = 1;
|
opterr = 1;
|
||||||
int opt;
|
int opt;
|
||||||
while ((opt = getopt(static_cast<int>(args.size()), args.data(),
|
while ((opt = getopt(static_cast<int>(args.size()), args.data(),
|
||||||
"e::lmos::vDINOSTVXa:b:c:d:f:h:i:n:p:r:t:x:z:C:E:F:L:P::R:")) != -1) {
|
"e::lmos::vDINOSTVXa:b:c:d:f:h:i:n:p:r:t:x:z:B:C:E:F:J:L:P::R:Z:")) != -1) {
|
||||||
switch (opt) {
|
switch (opt) {
|
||||||
case 'i':
|
case 'i':
|
||||||
if (const string error = SetIdAndLun(*device, optarg); !error.empty()) {
|
if (const string error = SetIdAndLun(*device, optarg); !error.empty()) {
|
||||||
cerr << "Error: " << error << endl;
|
cerr << "Error: " << error << endl;
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'C':
|
case 'C':
|
||||||
command.set_operation(CREATE_IMAGE);
|
command.set_operation(CREATE_IMAGE);
|
||||||
image_params = optarg;
|
image_params = optarg;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'b':
|
case 'b':
|
||||||
int block_size;
|
int block_size;
|
||||||
if (!GetAsUnsignedInt(optarg, block_size)) {
|
if (!GetAsUnsignedInt(optarg, block_size)) {
|
||||||
cerr << "Error: Invalid block size " << optarg << endl;
|
cerr << "Error: Invalid block size " << optarg << endl;
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
device->set_block_size(block_size);
|
device->set_block_size(block_size);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'c':
|
case 'c':
|
||||||
command.set_operation(parser.ParseOperation(optarg));
|
command.set_operation(parser.ParseOperation(optarg));
|
||||||
if (command.operation() == NO_OPERATION) {
|
if (command.operation() == NO_OPERATION) {
|
||||||
cerr << "Error: Unknown operation '" << optarg << "'" << endl;
|
cerr << "Error: Unknown operation '" << optarg << "'" << endl;
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'D':
|
case 'D':
|
||||||
command.set_operation(DETACH_ALL);
|
command.set_operation(DETACH_ALL);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'd':
|
case 'd':
|
||||||
command.set_operation(DELETE_IMAGE);
|
command.set_operation(DELETE_IMAGE);
|
||||||
image_params = optarg;
|
image_params = optarg;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'E':
|
case 'E':
|
||||||
command.set_operation(IMAGE_FILE_INFO);
|
filename = optarg;
|
||||||
filename = optarg;
|
if (filename.empty()) {
|
||||||
break;
|
cerr << "Error: Missing filename" << endl;
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
command.set_operation(IMAGE_FILE_INFO);
|
||||||
|
break;
|
||||||
|
|
||||||
case 'e':
|
case 'e':
|
||||||
command.set_operation(DEFAULT_IMAGE_FILES_INFO);
|
command.set_operation(DEFAULT_IMAGE_FILES_INFO);
|
||||||
if (optarg) {
|
if (optarg) {
|
||||||
SetCommandParams(command, optarg);
|
SetCommandParams(command, optarg);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'F':
|
||||||
|
command.set_operation(DEFAULT_FOLDER);
|
||||||
|
default_folder = optarg;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'f':
|
||||||
|
param = optarg;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'h':
|
||||||
|
hostname = optarg;
|
||||||
|
if (hostname.empty()) {
|
||||||
|
cerr << "Error: Missing hostname" << endl;
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'B':
|
||||||
|
filename_binary = optarg;
|
||||||
|
if (filename_binary.empty()) {
|
||||||
|
cerr << "Error: Missing filename" << endl;
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'J':
|
||||||
|
filename_json = optarg;
|
||||||
|
if (filename_json.empty()) {
|
||||||
|
cerr << "Error: Missing filename" << endl;
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'Z':
|
||||||
|
filename_text = optarg;
|
||||||
|
if (filename_text.empty()) {
|
||||||
|
cerr << "Error: Missing filename" << endl;
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'I':
|
||||||
|
command.set_operation(RESERVED_IDS_INFO);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'L':
|
||||||
|
command.set_operation(LOG_LEVEL);
|
||||||
|
log_level = optarg;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'l':
|
||||||
|
list = true;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'm':
|
||||||
|
command.set_operation(MAPPING_INFO);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'N':
|
||||||
|
command.set_operation(NETWORK_INTERFACES_INFO);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'O':
|
||||||
|
command.set_operation(LOG_LEVEL_INFO);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'o':
|
||||||
|
command.set_operation(OPERATION_INFO);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 't':
|
||||||
|
device->set_type(parser.ParseType(optarg));
|
||||||
|
if (device->type() == UNDEFINED) {
|
||||||
|
cerr << "Error: Unknown device type '" << optarg << "'" << endl;
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'r':
|
||||||
|
command.set_operation(RESERVE_IDS);
|
||||||
|
reserved_ids = optarg;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'R':
|
||||||
|
command.set_operation(RENAME_IMAGE);
|
||||||
|
image_params = optarg;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'n':
|
||||||
|
SetProductData(*device, optarg);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'p':
|
||||||
|
if (!GetAsUnsignedInt(optarg, port) || port <= 0 || port > 65535) {
|
||||||
|
cerr << "Error: Invalid port " << optarg << ", port must be between 1 and 65535" << endl;
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 's':
|
||||||
|
command.set_operation(SERVER_INFO);
|
||||||
|
if (optarg) {
|
||||||
|
if (const string error = SetCommandParams(command, optarg); !error.empty()) {
|
||||||
|
cerr << "Error: " << error << endl;
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
break;
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case 'F':
|
case 'S':
|
||||||
command.set_operation(DEFAULT_FOLDER);
|
command.set_operation(STATISTICS_INFO);
|
||||||
default_folder = optarg;
|
break;
|
||||||
break;
|
|
||||||
|
|
||||||
case 'f':
|
case 'v':
|
||||||
param = optarg;
|
cout << "scsictl version: " << piscsi_get_version_string() << '\n';
|
||||||
break;
|
exit(EXIT_SUCCESS);
|
||||||
|
break;
|
||||||
|
|
||||||
case 'h':
|
case 'P':
|
||||||
hostname = optarg;
|
token = optarg ? optarg : getpass("Password: ");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'I':
|
case 'V':
|
||||||
command.set_operation(RESERVED_IDS_INFO);
|
command.set_operation(VERSION_INFO);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'L':
|
case 'x':
|
||||||
command.set_operation(LOG_LEVEL);
|
command.set_operation(COPY_IMAGE);
|
||||||
log_level = optarg;
|
image_params = optarg;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'l':
|
case 'T':
|
||||||
list = true;
|
command.set_operation(DEVICE_TYPES_INFO);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'm':
|
case 'X':
|
||||||
command.set_operation(MAPPING_INFO);
|
command.set_operation(SHUT_DOWN);
|
||||||
break;
|
SetParam(command, "mode", "rascsi");
|
||||||
|
break;
|
||||||
|
|
||||||
case 'N':
|
case 'z':
|
||||||
command.set_operation(NETWORK_INTERFACES_INFO);
|
locale = optarg;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'O':
|
default:
|
||||||
command.set_operation(LOG_LEVEL_INFO);
|
break;
|
||||||
break;
|
}
|
||||||
|
}
|
||||||
case 'o':
|
|
||||||
command.set_operation(OPERATION_INFO);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 't':
|
|
||||||
device->set_type(parser.ParseType(optarg));
|
|
||||||
if (device->type() == UNDEFINED) {
|
|
||||||
cerr << "Error: Unknown device type '" << optarg << "'" << endl;
|
|
||||||
exit(EXIT_FAILURE);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'r':
|
|
||||||
command.set_operation(RESERVE_IDS);
|
|
||||||
reserved_ids = optarg;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'R':
|
|
||||||
command.set_operation(RENAME_IMAGE);
|
|
||||||
image_params = optarg;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'n':
|
|
||||||
SetProductData(*device, optarg);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'p':
|
|
||||||
if (!GetAsUnsignedInt(optarg, port) || port <= 0 || port > 65535) {
|
|
||||||
cerr << "Error: Invalid port " << optarg << ", port must be between 1 and 65535" << endl;
|
|
||||||
exit(EXIT_FAILURE);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 's':
|
|
||||||
command.set_operation(SERVER_INFO);
|
|
||||||
if (optarg) {
|
|
||||||
if (const string error = SetCommandParams(command, optarg); !error.empty()) {
|
|
||||||
cerr << "Error: " << error << endl;
|
|
||||||
exit(EXIT_FAILURE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'S':
|
|
||||||
command.set_operation(STATISTICS_INFO);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'v':
|
|
||||||
cout << "scsictl version: " << piscsi_get_version_string() << '\n';
|
|
||||||
exit(EXIT_SUCCESS);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'P':
|
|
||||||
token = optarg ? optarg : getpass("Password: ");
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'V':
|
|
||||||
command.set_operation(VERSION_INFO);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'x':
|
|
||||||
command.set_operation(COPY_IMAGE);
|
|
||||||
image_params = optarg;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'T':
|
|
||||||
command.set_operation(DEVICE_TYPES_INFO);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'X':
|
|
||||||
command.set_operation(SHUT_DOWN);
|
|
||||||
SetParam(command, "mode", "rascsi");
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'z':
|
|
||||||
locale = optarg;
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// For macos only 'optind != argc' appears to work, but then non-argument options do not reject arguments
|
// For macos only 'optind != argc' appears to work, but then non-argument options do not reject arguments
|
||||||
if (optopt) {
|
if (optopt) {
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
SetParam(command, "token", token);
|
if (!filename_json.empty()) {
|
||||||
SetParam(command, "locale", locale);
|
return ExportAsJson(command, filename_json);
|
||||||
|
}
|
||||||
|
if (!filename_binary.empty()) {
|
||||||
|
return ExportAsBinary(command, filename_binary);
|
||||||
|
}
|
||||||
|
if (!filename_text.empty()) {
|
||||||
|
return ExportAsText(command, filename_text);
|
||||||
|
}
|
||||||
|
|
||||||
|
SetParam(command, "token", token);
|
||||||
|
SetParam(command, "locale", locale);
|
||||||
|
|
||||||
ScsictlCommands scsictl_commands(command, hostname, port);
|
ScsictlCommands scsictl_commands(command, hostname, port);
|
||||||
|
|
||||||
@ -277,7 +328,7 @@ int ScsiCtl::run(const vector<char *>& args) const
|
|||||||
else {
|
else {
|
||||||
ParseParameters(*device, param);
|
ParseParameters(*device, param);
|
||||||
|
|
||||||
status = scsictl_commands.Execute(log_level, default_folder, reserved_ids, image_params, filename);
|
status = scsictl_commands.Execute(log_level, default_folder, reserved_ids, image_params, filename);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch(const io_exception& e) {
|
catch(const io_exception& e) {
|
||||||
@ -290,3 +341,48 @@ int ScsiCtl::run(const vector<char *>& args) const
|
|||||||
|
|
||||||
return status ? EXIT_SUCCESS : EXIT_FAILURE;
|
return status ? EXIT_SUCCESS : EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int ScsiCtl::ExportAsBinary(const PbCommand &command, const string &filename) const
|
||||||
|
{
|
||||||
|
const string binary = command.SerializeAsString();
|
||||||
|
|
||||||
|
ofstream out;
|
||||||
|
out.open(filename, ios::binary);
|
||||||
|
out << binary;
|
||||||
|
if (out.fail()) {
|
||||||
|
cerr << "Error: Can't create protobuf binary file '" << filename << "'" << endl;
|
||||||
|
return EXIT_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return EXIT_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
int ScsiCtl::ExportAsJson(const PbCommand &command, const string &filename) const
|
||||||
|
{
|
||||||
|
string json;
|
||||||
|
MessageToJsonString(command, &json);
|
||||||
|
|
||||||
|
ofstream out(filename);
|
||||||
|
out << json;
|
||||||
|
if (out.fail()) {
|
||||||
|
cerr << "Error: Can't create protobuf JSON file '" << filename << "'" << endl;
|
||||||
|
return EXIT_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return EXIT_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
int ScsiCtl::ExportAsText(const PbCommand &command, const string &filename) const
|
||||||
|
{
|
||||||
|
string text;
|
||||||
|
TextFormat::PrintToString(command, &text);
|
||||||
|
|
||||||
|
ofstream out(filename);
|
||||||
|
out << text;
|
||||||
|
if (out.fail()) {
|
||||||
|
cerr << "Error: Can't create protobuf text format file '" << filename << "'" << endl;
|
||||||
|
return EXIT_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return EXIT_SUCCESS;
|
||||||
|
}
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
// SCSI Target Emulator PiSCSI
|
// SCSI Target Emulator PiSCSI
|
||||||
// for Raspberry Pi
|
// for Raspberry Pi
|
||||||
//
|
//
|
||||||
// Copyright (C) 2022 Uwe Seimet
|
// Copyright (C) 2022-2023 Uwe Seimet
|
||||||
//
|
//
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
@ -28,4 +28,8 @@ class ScsiCtl
|
|||||||
private:
|
private:
|
||||||
|
|
||||||
void Banner(const vector<char *>&) const;
|
void Banner(const vector<char *>&) const;
|
||||||
|
|
||||||
|
int ExportAsBinary(const PbCommand&, const string&) const;
|
||||||
|
int ExportAsJson(const PbCommand&, const string&) const;
|
||||||
|
int ExportAsText(const PbCommand&, const string&) const;
|
||||||
};
|
};
|
||||||
|
@ -17,6 +17,10 @@ scsictl \- Sends management commands to the piscsi process
|
|||||||
\fB\-T\fR |
|
\fB\-T\fR |
|
||||||
\fB\-V\fR |
|
\fB\-V\fR |
|
||||||
\fB\-X\fR |
|
\fB\-X\fR |
|
||||||
|
\fB\-Z\fR |
|
||||||
|
[\fB\-d\fR \fIFILENAME\fR] |
|
||||||
|
[\fB\-B\fR \fIFILENAME\fR] |
|
||||||
|
[\fB\-J\fR \fIFILENAME\fR] |
|
||||||
[\fB\-C\fR \fIFILENAME:FILESIZE\fR] |
|
[\fB\-C\fR \fIFILENAME:FILESIZE\fR] |
|
||||||
[\fB\-E\fR \fIFILENAME\fR] |
|
[\fB\-E\fR \fIFILENAME\fR] |
|
||||||
[\fB\-F\fR \fIIMAGE_FOLDER\fR] |
|
[\fB\-F\fR \fIIMAGE_FOLDER\fR] |
|
||||||
@ -117,6 +121,15 @@ Shut down the piscsi process.
|
|||||||
.BR \-d\fI " "\fIFILENAME
|
.BR \-d\fI " "\fIFILENAME
|
||||||
Delete an image file in the default image folder.
|
Delete an image file in the default image folder.
|
||||||
.TP
|
.TP
|
||||||
|
.BR \-B\fI " "\fIFILENAME
|
||||||
|
Do not send command to piscsi but write it to a protobuf binary file.
|
||||||
|
.TP
|
||||||
|
.BR \-J\fI " "\fIFILENAME
|
||||||
|
Do not send command to piscsi but write it to a protobuf JSON file.
|
||||||
|
.TP
|
||||||
|
.BR \-Z\fI " "\fIFILENAME
|
||||||
|
Do not send command to piscsi but write it to a protobuf text format file.
|
||||||
|
.TP
|
||||||
.BR \-x\fI " "\fICURRENT_NAME:NEW_NAME
|
.BR \-x\fI " "\fICURRENT_NAME:NEW_NAME
|
||||||
Copy an image file in the default image folder.
|
Copy an image file in the default image folder.
|
||||||
.TP
|
.TP
|
||||||
|
@ -7,22 +7,23 @@ NAME
|
|||||||
|
|
||||||
SYNOPSIS
|
SYNOPSIS
|
||||||
scsictl -e | -l | -m | -o | -v | -D | -I | -L | -O | -P | -S | -T | -V
|
scsictl -e | -l | -m | -o | -v | -D | -I | -L | -O | -P | -S | -T | -V
|
||||||
| -X | [-C FILENAME:FILESIZE] | [-E FILENAME] | [-F IMAGE_FOLDER] | [-R
|
| -X | -Z | [-d FILENAME] | [-B FILENAME] | [-J FILENAME] | [-C FILE‐
|
||||||
CURRENT_NAME:NEW_NAME] | [-c CMD] | [-f FILE|PARAM] | [-g LOG_LEVEL] |
|
NAME:FILESIZE] | [-E FILENAME] | [-F IMAGE_FOLDER] | [-R CUR‐
|
||||||
[-h HOST] | [-i ID[:LUN]] | [-n NAME] | [-p PORT] | [-r RESERVED_IDS] |
|
RENT_NAME:NEW_NAME] | [-c CMD] | [-f FILE|PARAM] | [-g LOG_LEVEL] | [-h
|
||||||
[-s [FOLDER_PATTERN:FILE_PATTERN:OPERATIONS]] | [-t TYPE] | [-x CUR‐
|
HOST] | [-i ID[:LUN]] | [-n NAME] | [-p PORT] | [-r RESERVED_IDS] | [-s
|
||||||
|
[FOLDER_PATTERN:FILE_PATTERN:OPERATIONS]] | [-t TYPE] | [-x CUR‐
|
||||||
RENT_NAME:NEW_NAME] | [-z LOCALE]
|
RENT_NAME:NEW_NAME] | [-z LOCALE]
|
||||||
|
|
||||||
DESCRIPTION
|
DESCRIPTION
|
||||||
scsictl sends commands to the piscsi process to make configuration ad‐
|
scsictl sends commands to the piscsi process to make configuration ad‐
|
||||||
justments at runtime or to check the status of the devices.
|
justments at runtime or to check the status of the devices.
|
||||||
|
|
||||||
Either the -i or -l option should be specified at one time. Not both.
|
Either the -i or -l option should be specified at one time. Not both.
|
||||||
|
|
||||||
You do NOT need root privileges to use scsictl. scsictl also runs on
|
You do NOT need root privileges to use scsictl. scsictl also runs on
|
||||||
non-Pi Linux platforms.
|
non-Pi Linux platforms.
|
||||||
|
|
||||||
Note: The command and type arguments are case insensitive. Only the
|
Note: The command and type arguments are case insensitive. Only the
|
||||||
first letter of the command/type is evaluated by the tool.
|
first letter of the command/type is evaluated by the tool.
|
||||||
|
|
||||||
OPTIONS
|
OPTIONS
|
||||||
@ -41,7 +42,7 @@ OPTIONS
|
|||||||
-I Gets the list of reserved device IDs.
|
-I Gets the list of reserved device IDs.
|
||||||
|
|
||||||
-L LOG_LEVEL
|
-L LOG_LEVEL
|
||||||
Set the piscsi log level (trace, debug, info, warning, error,
|
Set the piscsi log level (trace, debug, info, warning, error,
|
||||||
off).
|
off).
|
||||||
|
|
||||||
-h HOST
|
-h HOST
|
||||||
@ -49,19 +50,19 @@ OPTIONS
|
|||||||
|
|
||||||
-e List all images files in the default image folder.
|
-e List all images files in the default image folder.
|
||||||
|
|
||||||
-N Lists all available network interfaces provided that they are
|
-N Lists all available network interfaces provided that they are
|
||||||
up.
|
up.
|
||||||
|
|
||||||
-O Display the available piscsi server log levels and the current
|
-O Display the available piscsi server log levels and the current
|
||||||
log level.
|
log level.
|
||||||
|
|
||||||
-P Prompt for the access token in case piscsi requires authentica‐
|
-P Prompt for the access token in case piscsi requires authentica‐
|
||||||
tion.
|
tion.
|
||||||
|
|
||||||
-l List all of the devices that are currently being emulated by
|
-l List all of the devices that are currently being emulated by
|
||||||
PiSCSI, as well as their current status.
|
PiSCSI, as well as their current status.
|
||||||
|
|
||||||
-m List all file extensions recognized by PiSCSI and the device
|
-m List all file extensions recognized by PiSCSI and the device
|
||||||
types they map to.
|
types they map to.
|
||||||
|
|
||||||
-o Display operation meta data information.
|
-o Display operation meta data information.
|
||||||
@ -73,11 +74,11 @@ OPTIONS
|
|||||||
The piscsi port to connect to, default is 6868.
|
The piscsi port to connect to, default is 6868.
|
||||||
|
|
||||||
-r RESERVED_IDS
|
-r RESERVED_IDS
|
||||||
Comma-separated list of IDs to reserve. Pass an empty list in
|
Comma-separated list of IDs to reserve. Pass an empty list in
|
||||||
order to not reserve anything.
|
order to not reserve anything.
|
||||||
|
|
||||||
-s [FOLDER_PATTERN:FILE_PATTERN:OPERATIONS]
|
-s [FOLDER_PATTERN:FILE_PATTERN:OPERATIONS]
|
||||||
Display server-side settings like available images or supported
|
Display server-side settings like available images or supported
|
||||||
device types.
|
device types.
|
||||||
|
|
||||||
-S Display statistics.
|
-S Display statistics.
|
||||||
@ -93,6 +94,18 @@ OPTIONS
|
|||||||
-d FILENAME
|
-d FILENAME
|
||||||
Delete an image file in the default image folder.
|
Delete an image file in the default image folder.
|
||||||
|
|
||||||
|
-B FILENAME
|
||||||
|
Do not send command to piscsi but write it to a protobuf binary
|
||||||
|
file.
|
||||||
|
|
||||||
|
-J FILENAME
|
||||||
|
Do not send command to piscsi but write it to a protobuf JSON
|
||||||
|
file.
|
||||||
|
|
||||||
|
-Z FILENAME
|
||||||
|
Do not send command to piscsi but write it to a protobuf text
|
||||||
|
format file.
|
||||||
|
|
||||||
-x CURRENT_NAME:NEW_NAME
|
-x CURRENT_NAME:NEW_NAME
|
||||||
Copy an image file in the default image folder.
|
Copy an image file in the default image folder.
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user