Store drive size instead of block number

This commit is contained in:
Daniel Markstedt 2021-09-19 18:35:15 -07:00
parent 54219f66d4
commit 591bbb4325
3 changed files with 23 additions and 31 deletions

View File

@ -5,7 +5,7 @@
"product": "RZ55 (C) DEC",
"revision": "",
"block_size": 512,
"blocks": 660960,
"size": 338411520,
"name": "DEC RZ55",
"file_type": "hds",
"description": "Largest recognized drive on Ultrix 3.0",
@ -17,7 +17,7 @@
"product": "RZ57 (C) DEC",
"revision": "5000",
"block_size": 512,
"blocks": 2050125,
"size": 1049664000,
"name": "DEC RZ57",
"file_type": "hds",
"description": "Largest recognized drive on Ultrix 3.1 - 4.3",
@ -29,7 +29,7 @@
"product": "RZ59 (C) DEC",
"revision": "2000",
"block_size": 512,
"blocks": 17755614,
"size": 9090874368,
"name": "DEC RZ59",
"file_type": "hds",
"description": "Largest recognized drive on OSF/1 3.x - 5.x",
@ -41,7 +41,7 @@
"product": "RZ74 (C) DEC",
"revision": "427H",
"block_size": 512,
"blocks": 6950125,
"size": 3558464000,
"name": "DEC RZ74",
"file_type": "hds",
"description": "Largest recognized drive on Ultrix 4.4 - 4.5",
@ -53,7 +53,7 @@
"product": "A2076",
"revision": "DD24",
"block_size": 512,
"blocks": 2621688,
"size": 1342304256,
"name": "HP A2076",
"file_type": "hds",
"description": "Largest recognized drive on HP-UX 8.0",
@ -65,7 +65,7 @@
"product": "C3010",
"revision": "6.0",
"block_size": 512,
"blocks": 3905792,
"size": 1999765504,
"name": "HP C3010",
"file_type": "hds",
"description": "Largest recognized drive on HP-UX 9.0",
@ -77,7 +77,7 @@
"product": "1325",
"revision": "",
"block_size": 512,
"blocks": 270336,
"size": 138412032,
"name": "Micropolis 1325",
"file_type": "hds",
"description": "Largest predefined on SunOS 2; Microp 1325 is actually an ESDI disk on an adapter.",
@ -89,7 +89,7 @@
"product": "1588T",
"revision": "",
"block_size": 512,
"blocks": 651840,
"size": 333742080,
"name": "Micropolis 1588-15",
"file_type": "hds",
"description": "Largest predefined on SunOS 3/4 (Sun-3)",
@ -101,7 +101,7 @@
"product": "ST32430N SUN2.1G",
"revision": "0444",
"block_size": 512,
"blocks": 4197405,
"size": 2149071360,
"name": "Seagate SUN2.1G",
"file_type": "hds",
"description": "Largest predefined for SunOS 4 (Sun-4) and Solaris 2.0-2.3",
@ -113,7 +113,7 @@
"product": "ST34371W SUN4.2G",
"revision": "7462",
"block_size": 512,
"blocks": 8380800,
"size": 4290969600,
"name": "Seagate SUN4.2G",
"file_type": "hds",
"description": "Recommended for Solaris 2.4+",
@ -125,7 +125,7 @@
"product": "ST39173W SUN9.0G",
"revision": "2815",
"block_size": 512,
"blocks": 17689267,
"size": 9056904704,
"name": "Seagate SUN9.0G",
"file_type": "hds",
"description": "Recommended for Solaris 2.4+",
@ -137,7 +137,7 @@
"product": "ST914603SSUN146G",
"revision": "0B70",
"block_size": 512,
"blocks": 286739329,
"size": 146810536448,
"name": "Seagate SUN146G",
"file_type": "hds",
"description": "Recommended for Solaris 2.4+",
@ -149,7 +149,7 @@
"product": "FIREBALL540S",
"revision": "",
"block_size": 512,
"blocks": 1065235,
"size": 545400320,
"name": "Quantum Fireball 540S",
"file_type": "hds",
"description": "Recommended for older Macintosh systems. Recognized by Apple HD SC Setup.",
@ -161,7 +161,7 @@
"product": "FIREBALL ST4.3S",
"revision": "0F0C",
"block_size": 512,
"blocks": 8471232,
"size": 4337270784,
"name": "Quantum Fireball ST4.3S",
"file_type": "hds",
"description": "Recommended for Macintosh System 6 or later. Recognized by Apple HD SC Setup.",
@ -173,7 +173,7 @@
"product": "ZIP 100",
"revision": "D.13",
"block_size": 512,
"blocks": 196608,
"size": 100663296,
"name": "Iomega ZIP 100",
"file_type": "hdr",
"description": "Removable Iomega ZIP drive, 100MB capacity",
@ -185,7 +185,7 @@
"product": "ZIP 250",
"revision": "D.58",
"block_size": 512,
"blocks": 489532,
"size": 250640384,
"name": "Iomega ZIP 250",
"file_type": "hdr",
"description": "Removable Iomega ZIP drive, 250MB capacity",
@ -197,7 +197,7 @@
"product": "JAZ 2GB",
"revision": "E.16",
"block_size": 512,
"blocks": 3909632,
"size": 2001731584,
"name": "Iomega Jaz 2GB",
"file_type": "hdr",
"description": "Removable Iomega Jaz drive, 2GB capacity",
@ -209,7 +209,7 @@
"product": "SQ5110C",
"revision": "4AA0",
"block_size": 512,
"blocks": 173456,
"size": 88809472,
"name": "SyQuest 88MB",
"file_type": "hdr",
"description": "SyQuest removable hard drive cartridges, 88MB capacity",
@ -221,7 +221,7 @@
"product": "CD-ROM XM-3401TA",
"revision": "0283",
"block_size": 512,
"blocks": null,
"size": null,
"name": "Toshiba XM-3401TA",
"file_type": null,
"description": "Boots most SGI, Sun, HP, IBM, DEC etc. Use only with Unix workstations of this vintage.",
@ -233,7 +233,7 @@
"product": "CD-ROM CDU-8012",
"revision": "3.1a",
"block_size": 512,
"blocks": null,
"size": null,
"name": "Sony CDU-8012",
"file_type": null,
"description": "Boots Sun-3. Use only with Unix workstations of this vintage.",
@ -245,7 +245,7 @@
"product": "A1448A",
"revision": "",
"block_size": 512,
"blocks": null,
"size": null,
"name": "HP A1448A",
"file_type": null,
"description": "Recognized by HP-UX. Use only with Unix workstations of this vintage.",
@ -257,7 +257,7 @@
"product": "RRD42 (C) DEC",
"revision": "4.5d",
"block_size": 512,
"blocks": null,
"size": null,
"name": "DEC RRD42",
"file_type": null,
"description": "Boots DECstations and VAXstations. Use only with Unix workstations of this vintage.",

View File

@ -61,6 +61,7 @@ def get_valid_scsi_ids(devices, reserved_ids):
return valid_ids
# TODO: This can probably be deprecated and use list_devices instead
def get_type(scsi_id):
device = proto.PbDeviceDefinition()
device.id = int(scsi_id)

View File

@ -100,14 +100,12 @@ def drive_list():
for d in conf:
if d["device_type"] == "SCHD":
d["size"] = d["block_size"] * d["blocks"]
d["size_mb"] = "{:,.2f}".format(d["size"] / 1024 / 1024)
hd_conf.append(d)
elif d["device_type"] == "SCCD":
d["size_mb"] = "N/A"
cd_conf.append(d)
elif d["device_type"] == "SCRM":
d["size"] = d["block_size"] * d["blocks"]
d["size_mb"] = "{:,.2f}".format(d["size"] / 1024 / 1024)
rm_conf.append(d)
@ -330,13 +328,6 @@ def attach():
flash(process["msg"], "error")
return redirect(url_for("index"))
conf = process["conf"]
# CD-ROM drives have no inherent size, so bypass the size check
if kwargs["device_type"] != "SCCD":
conf_file_size = int(conf["blocks"]) * int(conf["block_size"])
if conf_file_size != 0 and conf_file_size > int(file_size):
flash(f"Failed to attach {file_name} to SCSI id {scsi_id}!", "error")
flash(f"The file size {file_size} bytes needs to be at least {conf_file_size} bytes.", "error")
return redirect(url_for("index"))
kwargs["vendor"] = conf["vendor"]
kwargs["product"] = conf["product"]
kwargs["revision"] = conf["revision"]