[pve-devel] [PATCH storage] Diskmanage: add flag for encrypted osds

Dominik Csapak d.csapak at proxmox.com
Thu Jul 11 12:52:44 CEST 2019


we can only do this here, since the ceph cluster is not aware of
osd encryption, only the local node is (via ceph-volume and lv tags)

this way, we are able to show an 'encrypted' flag in the disk gui at least

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
this patch is intended to be commited on top of my last series
about the parttype uuid changes, if that is not commited
i can rebase and send this patch again (if desired)

 PVE/Diskmanage.pm | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/PVE/Diskmanage.pm b/PVE/Diskmanage.pm
index 8230aad..9b9d007 100644
--- a/PVE/Diskmanage.pm
+++ b/PVE/Diskmanage.pm
@@ -295,6 +295,9 @@ sub get_ceph_volume_infos {
 	    if (($type eq 'block' || $type eq 'data') && $fields->[2] =~ m/ceph.osd_id=([^,]+)/) {
 		$result->{$dev}->{osdid} = $1;
 		$result->{$dev}->{bluestore} = ($type eq 'block');
+		if ($fields->[2] =~ m/ceph\.encrypted=1/) {
+		    $result->{$dev}->{encrypted} = 1;
+		}
 	    } else {
 		# undef++ becomes '1' (see `perldoc perlop`: Auto-increment)
 		$result->{$dev}->{$type}++;
@@ -585,6 +588,7 @@ sub get_disks {
 
 	my $osdid = -1;
 	my $bluestore = 0;
+	my $osdencrypted;
 
 	my $journal_count = 0;
 	my $db_count = 0;
@@ -641,6 +645,7 @@ sub get_disks {
 	    if (defined($ceph_volume->{osdid})) {
 		$osdid = $ceph_volume->{osdid};
 		$bluestore = 1 if $ceph_volume->{bluestore};
+		$osdencrypted = $ceph_volume->{encrypted};
 	    }
 	}
 
@@ -659,6 +664,7 @@ sub get_disks {
 	$disklist->{$dev}->{osdid} = $osdid;
 	$disklist->{$dev}->{journals} = $journal_count if $journal_count;
 	$disklist->{$dev}->{bluestore} = $bluestore if $osdid != -1;
+	$disklist->{$dev}->{osdencrypted} = $osdencrypted if defined($osdencrypted);
 	$disklist->{$dev}->{db} = $db_count if $db_count;
 	$disklist->{$dev}->{wal} = $wal_count if $wal_count;
     });
-- 
2.20.1





More information about the pve-devel mailing list