Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disk image profile management using a sidecar config file #242

Merged
merged 72 commits into from
Sep 19, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
72 commits
Select commit Hold shift + click to select a range
26bddaf
Handle a case where reserved ids on the Web UI side are not actually …
rdmark Sep 16, 2021
b58d1af
Better error handling when no device is found in list_devices
rdmark Sep 16, 2021
917e37d
Better warning message
rdmark Sep 16, 2021
9b26cba
Tag message as error
rdmark Sep 16, 2021
fd5fd24
Fix device_info
rdmark Sep 16, 2021
a754017
Get reserved ids from the server instead of storing a client side sta…
rdmark Sep 16, 2021
fdcf336
Initial implementation of sidecar configuration reading and writing
rdmark Sep 16, 2021
8bbaa09
Use bytes for drive image creation internally
rdmark Sep 16, 2021
cdaea01
Add named drive section
rdmark Sep 16, 2021
4badf52
Move header to base.html
rdmark Sep 16, 2021
ac691b3
Create the disk profile list page
rdmark Sep 16, 2021
b6bf297
Make lists of HDDs, CDRs, and Removable drives
rdmark Sep 16, 2021
e348b31
Implement disk image + sidecar creation
rdmark Sep 16, 2021
de2b839
Implement CD-ROM device sidecar creation method
rdmark Sep 17, 2021
cd54fd0
Add more device configurations
rdmark Sep 17, 2021
b08162c
Add disclaimer
rdmark Sep 17, 2021
85cd898
Hide URL if none is provided
rdmark Sep 17, 2021
ed879c9
Merge branch 'feature_image_creation' into feature_sidecar
rdmark Sep 17, 2021
4db7ca2
Make the web ui use the new protobuf parameter maps
rdmark Sep 17, 2021
7979c53
Merge branch 'feature_image_creation' into feature_sidecar
rdmark Sep 17, 2021
72c839f
Make daynaport attaching UI more flexible
rdmark Sep 18, 2021
d1749b2
Use the protobuf interface to create image files
rdmark Sep 18, 2021
6a218b7
Use new create image method for the sidecar flow as well
rdmark Sep 18, 2021
3420527
Move file deletion logic to protobuf commands; Refactor saving/loadin…
rdmark Sep 18, 2021
ebf5c57
Update disk image creation
rdmark Sep 18, 2021
db51fd7
Fix error
rdmark Sep 18, 2021
18107f9
Merge branch 'feature_image_creation' into feature_sidecar
rdmark Sep 18, 2021
5913a2d
Disk images the script makes are in Mac format
rdmark Sep 18, 2021
34c6dda
Add blurb about the risks with using Lido driver (issue#40) to the ea…
rdmark Sep 18, 2021
461007f
Make shutdown and reboot async operations
rdmark Sep 18, 2021
7ca27b9
More informative footer contents
rdmark Sep 18, 2021
d39ffd6
Wordsmith the Mac drive options
rdmark Sep 18, 2021
e5bf992
Link to relevant section in the wiki
rdmark Sep 18, 2021
bf8e4af
Merge branch 'develop' into feature_sidecar
rdmark Sep 18, 2021
6b99f0d
Added GET_IMAGE_FILES
uweseimet Sep 18, 2021
2dceac7
Added default folder to GET_IMAGE_FILES
uweseimet Sep 18, 2021
25b496e
Renaming
uweseimet Sep 18, 2021
503f13b
Updated setting image folder
uweseimet Sep 18, 2021
87529fd
Lists available net interfaces as a drop down when attaching daynaport
rdmark Sep 18, 2021
b4110c6
Macs should use the hds image file ending
rdmark Sep 18, 2021
6ea25df
Fixed default image folder handling
uweseimet Sep 18, 2021
1e12c82
Refer to device properties, instead of sidecars
rdmark Sep 18, 2021
d3da336
Added NETWORK_INTERFACES_INFO
uweseimet Sep 18, 2021
03cf01f
Filter "lo"
uweseimet Sep 18, 2021
8dbcd7d
Use PF_INET in favor of PF_INET6
uweseimet Sep 18, 2021
c29aeb6
Added network interfaces to server info
uweseimet Sep 18, 2021
730ad9e
Drive property file ending defined in one place; Add handling of comm…
rdmark Sep 18, 2021
a4b4b81
Merge branch 'feature_interface_granularity' into feature_sidecar
rdmark Sep 18, 2021
af45250
Use protobuf interface to get network interface info
rdmark Sep 19, 2021
a8cdc86
Use protobuf interface for list_files
rdmark Sep 19, 2021
0fce4dc
Repeated field cleanup
uweseimet Sep 19, 2021
2cb71db
Renaming
uweseimet Sep 19, 2021
70e862d
Added DEVICE_TYPES_INFO
uweseimet Sep 19, 2021
a7e9e43
Comment update
uweseimet Sep 19, 2021
a2b0ec8
Added -y option to rasctl
uweseimet Sep 19, 2021
8bf2cb1
Add the remaining recommended drive profiles provided by rpajarola
rdmark Sep 19, 2021
25af2ed
Resolve merge conflict
rdmark Sep 19, 2021
d864d3c
Fix typos
rdmark Sep 19, 2021
3b23477
Add warnings to CD-ROM descriptions
rdmark Sep 19, 2021
7294ae2
Add more recommended Sun drives
rdmark Sep 19, 2021
65624b2
Add capacity to name
rdmark Sep 19, 2021
515066f
Move footer into base.html
rdmark Sep 19, 2021
8681056
Handle removable drive insertion in the attach method (easy to do wit…
rdmark Sep 19, 2021
b902b23
Limit which arguments to pass to an image injection command
rdmark Sep 19, 2021
409579c
Cleanup
rdmark Sep 19, 2021
1e605bb
Sort image and config files alphabetically
rdmark Sep 19, 2021
c87cc4f
Merge branch 'feature_interface_cleanup' into feature_sidecar
rdmark Sep 19, 2021
38a0615
Make compatible with updated protobuf interface
rdmark Sep 19, 2021
2f045eb
Sort drives alphabetically by name
rdmark Sep 19, 2021
8ce3979
Decriptive text for CD-ROM section
rdmark Sep 19, 2021
0b6f6dd
Better description
rdmark Sep 19, 2021
a4896a8
Hyperlink to disks page instead of button
rdmark Sep 19, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions doc/rasctl.1
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ rasctl \- Sends management commands to the rascsi process
\fB\-k\fR |
\fB\-l\fR |
\fB\-s\fR |
\fB\-y\fR |
[\fB\-d\fR \fIIMAGE_FOLDER\fR]
[\fB\-g\fR \fILOG_LEVEL\fR]
[\fB\-h\fR \fIHOST\fR]
Expand Down Expand Up @@ -64,6 +65,9 @@ Comma-separated list of IDs to reserve.
.BR \-s\fI
Display server-side settings like available images or supported device types.
.TP
.BR \-y\fI
Display all device types and their properties.
.TP
.BR \-v\fI " " \fI
Display the rascsi version.
.TP
Expand Down
8 changes: 5 additions & 3 deletions doc/rasctl_man_page.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ NAME
rasctl - Sends management commands to the rascsi process

SYNOPSIS
rasctl -e | -k | -l | -s | [-d IMAGE_FOLDER] [-g LOG_LEVEL] [-h HOST]
[-p PORT] [-r RESERVED_IDS] [-v] -i ID [-c CMD] [-f FILE|PARAM] [-n
NAME] [-t TYPE] [-u UNIT]
rasctl -e | -k | -l | -s | -y | [-d IMAGE_FOLDER] [-g LOG_LEVEL] [-h
HOST] [-p PORT] [-r RESERVED_IDS] [-v] -i ID [-c CMD] [-f FILE|PARAM]
[-n NAME] [-t TYPE] [-u UNIT]

DESCRIPTION
rasctl Sends commands to the rascsi process to make configuration ad‐
Expand Down Expand Up @@ -56,6 +56,8 @@ OPTIONS
-s Display server-side settings like available images or supported
device types.

-y Display all device types and their properties.

-v Display the rascsi version.

-w FILENAME
Expand Down
25 changes: 6 additions & 19 deletions easyinstall.sh
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ function createDrive() {
driveSize=$1
driveName=$2
mkdir -p $VIRTUAL_DRIVER_PATH
drivePath="${VIRTUAL_DRIVER_PATH}/${driveSize}MB.hda"
drivePath="${VIRTUAL_DRIVER_PATH}/${driveSize}MB.hds"

if [ ! -f $drivePath ]; then
echo "Creating a ${driveSize}MB Drive"
Expand Down Expand Up @@ -415,19 +415,6 @@ function reserveScsiIds() {

function runChoice() {
case $1 in
0)
echo "Installing / Updating RaSCSI Service (${CONNECT_TYPE-FULLSPEC}) + Web interface + 600MB Drive"
stopOldWebInterface
updateRaScsiGit
createImagesDir
installPackages
installRaScsi
installRaScsiWebInterface
createDrive600MB
showRaScsiStatus
showRaScsiWebStatus
echo "Installing / Updating RaSCSI Service (${CONNECT_TYPE-FULLSPEC}) + Web interface + 600MB Drive - Complete!"
;;
1)
echo "Installing / Updating RaSCSI Service (${CONNECT_TYPE-FULLSPEC}) + Web interface"
stopOldWebInterface
Expand Down Expand Up @@ -501,11 +488,11 @@ function showMenu() {
echo ""
echo "Choose among the following options:"
echo "INSTALL/UPDATE RASCSI (${CONNECT_TYPE-FULLSPEC} version)"
echo " 0) install or update RaSCSI Service + web interface + 600MB Drive (recommended)"
echo " 1) install or update RaSCSI Service + web interface"
echo " 1) install or update RaSCSI Service + Web Interface"
echo " 2) install or update RaSCSI Service"
echo "CREATE EMPTY DRIVE IMAGE"
echo " 3) 600MB drive (recommended)"
echo "CREATE HFS FORMATTED (MAC) IMAGE WITH LIDO DRIVERS"
echo "** For the Mac Plus, it's better to create an image through the Web Interface **"
echo " 3) 600MB drive (suggested size)"
echo " 4) custom drive size (up to 4000MB)"
echo "NETWORK ASSISTANT"
echo " 5) configure network forwarding over Ethernet (DHCP)"
Expand All @@ -531,7 +518,7 @@ while [ "$1" != "" ]; do
;;
esac
case $VALUE in
FULLSPEC | STANDARD | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7)
FULLSPEC | STANDARD | 1 | 2 | 3 | 4 | 5 | 6 | 7)
;;
*)
echo "ERROR: unknown option \"$VALUE\""
Expand Down
58 changes: 39 additions & 19 deletions src/raspberrypi/rascsi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
#include "spdlog/sinks/stdout_color_sinks.h"
#include <spdlog/async.h>
#include <sys/sendfile.h>
#include <ifaddrs.h>
#include <string>
#include <sstream>
#include <iostream>
Expand Down Expand Up @@ -506,24 +507,24 @@ PbDeviceProperties *GetDeviceProperties(const Device *device)
return properties;
}

void GetDeviceTypeProperties(PbServerInfo& server_info, PbDeviceType type)
void GetDeviceTypeProperties(PbDeviceTypesInfo& device_types_info, PbDeviceType type)
{
PbDeviceTypeProperties *types_properties = server_info.add_types_properties();
types_properties->set_type(type);
PbDeviceTypeProperties *type_properties = device_types_info.add_properties();
type_properties->set_type(type);
Device *device = device_factory.CreateDevice(type, "", "");
types_properties->set_allocated_properties(GetDeviceProperties(device));
type_properties->set_allocated_properties(GetDeviceProperties(device));
delete device;
}

void GetAllDeviceTypeProperties(PbServerInfo& server_info)
void GetAllDeviceTypeProperties(PbDeviceTypesInfo& device_types_info)
{
GetDeviceTypeProperties(server_info, SAHD);
GetDeviceTypeProperties(server_info, SCHD);
GetDeviceTypeProperties(server_info, SCRM);
GetDeviceTypeProperties(server_info, SCMO);
GetDeviceTypeProperties(server_info, SCCD);
GetDeviceTypeProperties(server_info, SCBR);
GetDeviceTypeProperties(server_info, SCDP);
GetDeviceTypeProperties(device_types_info, SAHD);
GetDeviceTypeProperties(device_types_info, SCHD);
GetDeviceTypeProperties(device_types_info, SCRM);
GetDeviceTypeProperties(device_types_info, SCMO);
GetDeviceTypeProperties(device_types_info, SCCD);
GetDeviceTypeProperties(device_types_info, SCBR);
GetDeviceTypeProperties(device_types_info, SCDP);
}

void GetAvailableImages(PbServerInfo& server_info)
Expand Down Expand Up @@ -608,15 +609,15 @@ void GetDevice(const Device *device, PbDevice *pb_device)
void GetDevices(PbServerInfo& serverInfo)
{
for (const Device *device : devices) {
// skip if unit does not exist or is not assigned
// Skip if unit does not exist or is not assigned
if (device) {
PbDevice *pb_device = serverInfo.add_devices();
PbDevice *pb_device = serverInfo.mutable_devices()->add_devices();
GetDevice(device, pb_device);
}
}
}

void GetDeviceInfo(const PbCommand& command, PbResult& result)
void GetDevicesInfo(const PbCommand& command, PbResult& result)
{
set<id_set> id_sets;
if (!command.devices_size()) {
Expand Down Expand Up @@ -650,6 +651,14 @@ void GetDeviceInfo(const PbCommand& command, PbResult& result)
}
}

void GetDeviceTypesInfo(const PbCommand& command, PbResult& result)
{
PbDeviceTypesInfo *device_types_info = new PbDeviceTypesInfo();
GetAllDeviceTypeProperties(*device_types_info);

result.set_allocated_device_types_info(device_types_info);
}

void GetServerInfo(PbResult& result)
{
PbServerInfo *server_info = new PbServerInfo();
Expand All @@ -659,7 +668,7 @@ void GetServerInfo(PbResult& result)
server_info->set_patch_version(rascsi_patch_version);
GetLogLevels(*server_info);
server_info->set_current_log_level(current_log_level);
GetAllDeviceTypeProperties(*server_info);
GetAllDeviceTypeProperties(*server_info->mutable_device_types_info());
GetAvailableImages(*server_info);
PbNetworkInterfacesInfo * network_interfaces_info = new PbNetworkInterfacesInfo();
server_info->set_allocated_network_interfaces_info(network_interfaces_info);
Expand Down Expand Up @@ -1659,7 +1668,7 @@ bool ParseArgument(int argc, char* argv[], int& port)
// Display and log the device list
PbServerInfo server_info;
GetDevices(server_info);
const list<PbDevice>& devices = { server_info.devices().begin(), server_info.devices().end() };
const list<PbDevice>& devices = { server_info.devices().devices().begin(), server_info.devices().devices().end() };
const string device_list = ListDevices(devices);
LogDevices(device_list);
cout << device_list << endl;
Expand Down Expand Up @@ -1760,12 +1769,12 @@ static void *MonThread(void *param)
break;
}

case DEVICE_INFO: {
case DEVICES_INFO: {
LOGTRACE(string("Received " + PbOperation_Name(command.operation()) + " command").c_str());

PbResult result;
result.set_status(true);
GetDeviceInfo(command, result);
GetDevicesInfo(command, result);
SerializeMessage(fd, result);
const list<PbDevice>& devices ={ result.device_info().devices().begin(), result.device_info().devices().end() };

Expand All @@ -1776,6 +1785,17 @@ static void *MonThread(void *param)
break;
}

case DEVICE_TYPES_INFO: {
LOGTRACE(string("Received " + PbOperation_Name(command.operation()) + " command").c_str());

PbResult result;
result.set_status(true);
GetDeviceTypesInfo(command, result);
SerializeMessage(fd, result);
break;
}


case SERVER_INFO: {
LOGTRACE(string("Received " + PbOperation_Name(command.operation()) + " command").c_str());

Expand Down
51 changes: 31 additions & 20 deletions src/raspberrypi/rascsi_interface.proto
Original file line number Diff line number Diff line change
Expand Up @@ -67,64 +67,67 @@ enum PbOperation {
SERVER_INFO = 10;

// Gets information on attached devices. Returns data for all attached devices if empty.
DEVICE_INFO = 11;
DEVICES_INFO = 11;

// Device properties by device type
DEVICE_TYPES_INFO = 12;

// Gets information on available image files. A lightweight alternative to getting the complete server info.
IMAGE_FILES_INFO = 12;
IMAGE_FILES_INFO = 13;

// Gets the names of the available network interfaces. Only lists interfaces that are up.
NETWORK_INTERFACES_INFO = 13;
NETWORK_INTERFACES_INFO = 14;

// Set the default folder for image files.
// Parameters:
// "folder": The default folder name.
DEFAULT_FOLDER = 14;
DEFAULT_FOLDER = 15;

// Set server log level.
// Parameters:
// "level": The new log level
LOG_LEVEL = 15;
LOG_LEVEL = 16;

// Block IDs from being used, usually the IDs of the initiators (computers) in the SCSI chain.
// Parameters:
// "ids": A comma-separated list of IDs to reserve, or an empty string in order not to reserve any ID.
RESERVE = 16;
RESERVE = 17;

// Create an image file. The image file must not yet exist.
// Parameters:
// "file": The filename, relative to the default image folder. It must not contain a slash.
// "size": The file size in bytes, must be a multiple of 512
// "read_only": "true" (case-insensitive) in order to create a read-only file, otherwise "false"
CREATE_IMAGE = 17;
CREATE_IMAGE = 18;

// Delete an image file.
// Parameters:
// "file": The filename, relative to the default image folder. It must not contain a slash.
DELETE_IMAGE = 18;
DELETE_IMAGE = 19;

// Rename an image file.
// Parameters:
// "from": The old filename, relative to the default image folder. It must not contain a slash.
// "to": The new filename, relative to the default image folder. It must not contain a slash.
// The new filename must not yet exist.
RENAME_IMAGE = 19;
RENAME_IMAGE = 20;

// Copy an image file.
// Parameters:
// "from": The source filename, relative to the default image folder. It must not contain a slash.
// "to": The destination filename, relative to the default image folder. It must not contain a slash.
// The destination filename must not yet exist.
COPY_IMAGE = 20;
COPY_IMAGE = 21;

// Write-protect an image file.
// Parameters:
// "file": The filename, relative to the default image folder. It must not contain a slash.
PROTECT_IMAGE = 21;
// "file": The filename, relative to the default image folder. It must not contain a slash.
PROTECT_IMAGE = 22;

// Make an image file writable.
// Parameters:
// "file": The filename, relative to the default image folder. It must not contain a slash.
UNPROTECT_IMAGE = 22;
// "file": The filename, relative to the default image folder. It must not contain a slash.
UNPROTECT_IMAGE = 23;
}

// The properties supported by a device
Expand Down Expand Up @@ -171,6 +174,10 @@ message PbDeviceTypeProperties {
PbDeviceProperties properties = 2;
}

message PbDeviceTypesInfo {
repeated PbDeviceTypeProperties properties = 1;
}

// The image file data
message PbImageFile {
string name = 1;
Expand Down Expand Up @@ -251,10 +258,12 @@ message PbResult {
PbServerInfo server_info = 3;
// The result of a DEVICE_INFO command
PbDevices device_info = 4;
// The result of a DEVICE_TYPES_INFO command
PbDeviceTypesInfo device_types_info = 5;
// The result of an IMAGE_FILES_INFO command
PbImageFilesInfo image_files_info = 5;
PbImageFilesInfo image_files_info = 6;
// The result of a NETWORK_INTERFACES_INFO command
PbNetworkInterfacesInfo network_interfaces_info = 6;
PbNetworkInterfacesInfo network_interfaces_info = 7;
}
}

Expand All @@ -268,12 +277,14 @@ message PbServerInfo {
// List of available log levels, ordered by increasing by severity
repeated string log_levels = 4;
string current_log_level = 5;
// Supported device types and their properties
repeated PbDeviceTypeProperties types_properties = 6;
// Supported device types and their properties, also available separately
PbDeviceTypesInfo device_types_info = 6;
// The image files in the default folder, also available separately
PbImageFilesInfo image_files_info = 7;
// The available (up) network interfaces, also available separately
PbNetworkInterfacesInfo network_interfaces_info = 8;
// The attached devices
repeated PbDevice devices = 9;
// The attached devices, also available separately
PbDevices devices = 9;
// The unsorted list of reserved IDs
repeated uint32 reserved_ids = 10;
}
Loading