Skip to content

Commit

Permalink
updated manifest for latest build, and removed prerelease flag
Browse files Browse the repository at this point in the history
  • Loading branch information
markdhooper committed Sep 14, 2022
1 parent 6e29957 commit 9358dab
Show file tree
Hide file tree
Showing 8 changed files with 89 additions and 34 deletions.
77 changes: 56 additions & 21 deletions 45drives-disks/public/scripts/zfs_info
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ def get_zfs_list():
try:
zfs_list_result = subprocess.Popen(
["zfs", "list"], stdout=subprocess.PIPE, stderr=subprocess.DEVNULL, universal_newlines=True).stdout
# zfs_list_result = subprocess.Popen(
# ["cat","/root/spoof/zfs_list"], stdout=subprocess.PIPE, stderr=subprocess.DEVNULL, universal_newlines=True).stdout
except:
return False

Expand All @@ -35,6 +37,8 @@ def get_zpool_list():
try:
zpool_list_result = subprocess.Popen(
["zpool", "list"], stdout=subprocess.PIPE, stderr=subprocess.DEVNULL, universal_newlines=True).stdout
# zpool_list_result = subprocess.Popen(
# ["cat","/root/spoof/zpool_list"], stdout=subprocess.PIPE, stderr=subprocess.DEVNULL, universal_newlines=True).stdout
except:
return False
#NAME SIZE ALLOC FREE CKPOINT EXPANDSZ FRAG CAP DEDUP HEALTH ALTROOT
Expand Down Expand Up @@ -79,6 +83,8 @@ def zpool_status(pool_name):
try:
zpool_status_result = subprocess.Popen(
["zpool", "status", pool_name], stdout=subprocess.PIPE, stderr=subprocess.DEVNULL, universal_newlines=True).stdout.read()
# zpool_status_result = subprocess.Popen(
# ["cat","/root/spoof/zpool_status"], stdout=subprocess.PIPE, stderr=subprocess.DEVNULL, universal_newlines=True).stdout.read()
except:
print(f"failed to run 'zpool status {pool_name}'")
exit(1)
Expand All @@ -90,6 +96,8 @@ def zpool_iostat(pool_name):
try:
zpool_status_result = subprocess.Popen(
["zpool", "iostat","-v", pool_name], stdout=subprocess.PIPE, stderr=subprocess.DEVNULL, universal_newlines=True).stdout.read()
# zpool_status_result = subprocess.Popen(
# ["cat","/root/spoof/zpool_iostat_v"], stdout=subprocess.PIPE, stderr=subprocess.DEVNULL, universal_newlines=True).stdout.read()
except:
print(f"failed to run 'zpool iostat -v {pool_name}'")
exit(1)
Expand Down Expand Up @@ -117,20 +125,28 @@ def zpool_status_parse(zp_status_obj,key):
"read_errors": match.group(3),
"write_errors": match.group(4),
"checksum_errors": match.group(5)
} for match in re.finditer(r"^\t\s+(\d+-\d+)(?:-part[0-9])?\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+).*",zp_status_obj[key],flags=re.MULTILINE)
} for match in re.finditer(r"^\t (\S+)(?:-part[0-9])?\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+).*",zp_status_obj[key],flags=re.MULTILINE)
]

exception_match = r"^(\d+-\d+)(?:-part[0-9])"
for disk in disks:
match = re.match(exception_match,disk["name"])
if match:
disk["name"] = match.group(1)

counts = []
disk_count = 0
initial_disk = True
for line in zp_status_obj[key].splitlines():
regex_vdev = re.search("^\t (\S+-\d+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+).*",line)
regex_disk = re.search("^\t\s+(\d+-\d+)(?:-part[0-9])?\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+).*",line)
if regex_vdev != None and disk_count > 0:
regex_disk = re.search("^\t (\S+)(?:-part[0-9])?\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+).*",line)
if regex_vdev != None and not initial_disk:
counts.append(disk_count)
disk_count = 0
if regex_disk != None:
initial_disk = False
disk_count = disk_count + 1
if disk_count > 0:
counts.append(disk_count)
counts.append(disk_count)

return vdevs, disks, counts

Expand Down Expand Up @@ -159,24 +175,30 @@ def zpool_iostat_parse(zp_status_obj,key):
"write_ops": match.group(5),
"read_bw": match.group(6),
"write_bw": match.group(7)
} for match in re.finditer(r"^\s+(\d+-\d+)(?:-part[0-9])?\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+).*",zp_status_obj[key],flags=re.MULTILINE)
} for match in re.finditer(r"^ (\S+)(?:-part[0-9])?\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+).*",zp_status_obj[key],flags=re.MULTILINE)
]

exception_match = r"^(\d+-\d+)(?:-part[0-9])"
for disk in disks:
match = re.match(exception_match,disk["name"])
if match:
disk["name"] = match.group(1)

counts = []
disk_count = 0
for line in zp_status_obj[key].splitlines():
regex_vdev = re.search("^ (\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+).*",line)
regex_disk = re.search("^ (\d+-\d+)(?:-part[0-9])?\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+).*",line)
regex_disk = re.search("^ (\S+)(?:-part[0-9])?\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+).*",line)
if regex_vdev != None and disk_count > 0:
counts.append(disk_count)
disk_count = 0
if regex_disk != None:
disk_count = disk_count + 1
if disk_count > 0:
counts.append(disk_count)

counts.append(disk_count)
return vdevs, disks, counts

def verify_zfs_device_format(zp_status_obj,pool_name):
alert = []
default_pattern = r"^\t (\d+-\d+)(?:-part[0-9])?\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+).*"
unsupported_pattern = r"^\t (\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+).*"
disks = [
Expand All @@ -189,9 +211,7 @@ def verify_zfs_device_format(zp_status_obj,pool_name):
"checksum_errors": match.group(5)
} for match in re.finditer(default_pattern,zp_status_obj[pool_name],flags=re.MULTILINE)
]
if len(disks) == 0:
# default pattern didn't match.
unsupported_disks = [
unsupported_disks = [
{
"tag":pool_name,
"name":match.group(1),
Expand All @@ -200,25 +220,40 @@ def verify_zfs_device_format(zp_status_obj,pool_name):
"write_errors": match.group(4),
"checksum_errors": match.group(5)
} for match in re.finditer(unsupported_pattern,zp_status_obj[pool_name],flags=re.MULTILINE)
]
print("Unsupported device format for zpool '{pn}'\n".format(pn=pool_name))
print("This module will only display zpool information when all zpools are created using a device alias.\n")
print("This can be done using the 45Drives cockpit-zfs-manager package:\nhttps://github.com/45Drives/cockpit-zfs-manager/releases/\n")
]
if len(unsupported_disks) > len(disks):
for disk in disks:
if disk in unsupported_disks:
unsupported_disks.remove(disk)
exception_match = r"^(\d+-\d+)(?:-part[0-9])"
for disk in unsupported_disks:
match = re.match(exception_match,disk["name"])
if match:
unsupported_disks.remove(disk)
# default pattern didn't match.
alert.append("ZFS status displayed by this module for zpool '{pn}' may be incomplete.\n\n".format(pn=pool_name))
alert.append("This module can only display zfs status information for devices that are created using a device alias.\n\n")
alert.append("This can be done using the 45Drives cockpit-zfs-manager package:\nhttps://github.com/45Drives/cockpit-zfs-manager/releases/\n\n")
if unsupported_disks:
print("The following zfs devices do not conform: ")
alert.append("The following zfs devices do not conform:\n")
for disk in unsupported_disks:
print("\t {d}".format(d=disk["name"]))
sys.exit(1)
alert.append("\t {d}\n".format(d=disk["name"]))
alert.append("\n")
#sys.exit(1)
return alert


def get_zpool_status():
json_zfs["warnings"] = []
for pool in json_zfs["zpools"]:
# run 'zpool status <pool>' and 'zpool iostat -v <pool>' and group output by top level entry (<pool name>, special, cache etc.)
status_output = zpool_status(pool["name"])
iostat_output = zpool_iostat(pool["name"])
pool["state"] = status_output["state"]
pool["vdevs"] = []
verify_zfs_device_format(status_output,pool["name"])
alert = verify_zfs_device_format(status_output,pool["name"])
if alert:
json_zfs["warnings"] = json_zfs["warnings"] + alert
for key in status_output.keys():
# parse the output of both commands by top level entry
if key in iostat_output.keys():
Expand Down
8 changes: 8 additions & 0 deletions 45drives-disks/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,14 @@ export default {
).promise();
let result = JSON.parse(state.stdout);
Object.assign(zfsInfo, result);
if (result.warnings && result.warnings.length > 0){
notifications.value.constructNotification(
"Warning:",
errorStringHTML(result.warnings.join("")),
"warning",
0
);
}
preloadChecks.zfs.content = result;
preloadChecks.zfs.finished = true;
preloadChecks.zfs.failed = !result?.zfs_installed;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@
"type": "CPU1_DIMM_D2",
"id": 2,
"shape": "rect",
"x0": 502,
"x0": 485,
"y0": 290,
"width": 20,
Expand Down
7 changes: 3 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
## cockpit-45drives-hardware 2.2.0-2
## cockpit-45drives-hardware 2.2.1-1

* added support for ASRockRack EPC621D8A Motherboards
* updated how PCI cards are rendered in 45drives-motherboard
* updated helper scripts in 45drives-System and 45drives-Motherboard to work with ASRockRack EPC621D8A Motherboards
* updated zfs_info script in 45drives-disks to inform user about the requirement for zfs devices to be using device aliases
* added support for ASRockRack EPC621D8A Motherboards in 45Drives-motherboard
* updated 45drives-tools dependency to 2.1.0
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
PLUGIN_SRCS=

# For installing to a remote machine for testing with `make install-remote`
REMOTE_TEST_HOST=192.168.13.33
REMOTE_TEST_HOST=192.168.210.246
REMOTE_TEST_USER=root

# Restarts cockpit after install
Expand Down
14 changes: 7 additions & 7 deletions manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
"__version": "45D-R1",
"name": "cockpit-45drives-hardware",
"title": "cockpit-45drives-hardware",
"prerelease": true,
"version": "2.2.0",
"buildVersion": "2",
"prerelease": false,
"version": "2.2.1",
"buildVersion": "1",
"author": "Mark Hooper <[email protected]>",
"url": "https://github.com/45Drives/cockpit-hardware",
"category": "utils",
Expand All @@ -30,7 +30,7 @@
"dmidecode",
"ipmitool",
"lshw",
"45drives-tools (>= 2.0.8)",
"45drives-tools (>= 2.1.0)",
"iproute2"
],
"el": [
Expand All @@ -41,7 +41,7 @@
"dmidecode",
"ipmitool",
"lshw",
"45drives-tools >= 2.0.8"
"45drives-tools >= 2.1.0"
]
},
"releases": [
Expand All @@ -58,8 +58,8 @@
],
"changelog": {
"urgency": "medium",
"version": "2.2.0",
"buildVersion": "2",
"version": "2.2.1",
"buildVersion": "1",
"ignore": [],
"date": null,
"packager": "Mark Hooper <[email protected]>",
Expand Down
5 changes: 5 additions & 0 deletions packaging/el8/main.spec
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@ make DESTDIR=%{buildroot} install
/usr/lib/udev/rules.d/68-cockpit-45drives-disks.rules

%changelog
* Wed Sep 14 2022 Mark Hooper <[email protected]> 2.2.1-1
- updated zfs_info script in 45drives-disks to inform user about the requirement
for zfs devices to be using device aliases
- added support for ASRockRack EPC621D8A Motherboards in 45Drives-motherboard
- updated 45drives-tools dependency to 2.1.0
* Tue Aug 23 2022 Mark Hooper <[email protected]> 2.2.0-2
- added support for ASRockRack EPC621D8A Motherboards
- updated how PCI cards are rendered in 45drives-motherboard
Expand Down
9 changes: 9 additions & 0 deletions packaging/focal/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
cockpit-45drives-hardware (2.2.1-1focal) focal; urgency=medium

* updated zfs_info script in 45drives-disks to inform user about the requirement
for zfs devices to be using device aliases
* added support for ASRockRack EPC621D8A Motherboards in 45Drives-motherboard
* updated 45drives-tools dependency to 2.1.0

-- Mark Hooper <[email protected]> Wed, 14 Sep 2022 05:38:36 -0300

cockpit-45drives-hardware (2.2.0-2focal) focal; urgency=medium

* added support for ASRockRack EPC621D8A Motherboards
Expand Down

0 comments on commit 9358dab

Please sign in to comment.