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

Fabian Grünbichler f.gruenbichler at proxmox.com
Fri Jul 12 16:02:21 CEST 2019


and this one as well, thanks!

On Fri, Jul 12, 2019 at 12:15:15PM +0200, Dominik Csapak wrote:
> 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>
> ---
> changes from v1:
> * use the same logic like blustore
> * add one test and fix the rest
>  PVE/Diskmanage.pm                             | 6 ++++++
>  test/disk_tests/usages/disklist_expected.json | 4 ++++
>  test/disk_tests/usages/lvs                    | 2 +-
>  3 files changed, 11 insertions(+), 1 deletion(-)
> 
> diff --git a/PVE/Diskmanage.pm b/PVE/Diskmanage.pm
> index 196eee5..2a0a015 100644
> --- a/PVE/Diskmanage.pm
> +++ b/PVE/Diskmanage.pm
> @@ -292,6 +292,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}++;
> @@ -582,6 +585,7 @@ sub get_disks {
>  
>  	my $osdid = -1;
>  	my $bluestore = 0;
> +	my $osdencrypted = 0;
>  
>  	my $journal_count = 0;
>  	my $db_count = 0;
> @@ -638,6 +642,7 @@ sub get_disks {
>  	    if (defined($ceph_volume->{osdid})) {
>  		$osdid = $ceph_volume->{osdid};
>  		$bluestore = 1 if $ceph_volume->{bluestore};
> +		$osdencrypted = 1 if $ceph_volume->{encrypted};
>  	    }
>  	}
>  
> @@ -656,6 +661,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 $osdid != -1;
>  	$disklist->{$dev}->{db} = $db_count if $db_count;
>  	$disklist->{$dev}->{wal} = $wal_count if $wal_count;
>      });
> diff --git a/test/disk_tests/usages/disklist_expected.json b/test/disk_tests/usages/disklist_expected.json
> index b179cd6..b2e37c0 100644
> --- a/test/disk_tests/usages/disklist_expected.json
> +++ b/test/disk_tests/usages/disklist_expected.json
> @@ -4,6 +4,7 @@
>  	"rpm" : 0,
>  	"size" : 1536000,
>  	"type" : "hdd",
> +	"osdencrypted": 0,
>  	"osdid" : "444",
>  	"bluestore" : "0",
>  	"health" : "UNKNOWN",
> @@ -104,6 +105,7 @@
>  	"rpm" : 0,
>  	"type" : "hdd",
>  	"bluestore": 1,
> +	"osdencrypted": 0,
>  	"osdid" : 1
>      },
>      "sdh" : {
> @@ -152,6 +154,7 @@
>  	"rpm" : 0,
>  	"bluestore": 0,
>  	"type" : "hdd",
> +	"osdencrypted": 1,
>  	"osdid" : 0
>      },
>      "sdk" : {
> @@ -168,6 +171,7 @@
>  	"rpm" : 0,
>  	"bluestore": 0,
>  	"type" : "hdd",
> +	"osdencrypted": 0,
>  	"osdid" : 230
>      },
>      "sdl" : {
> diff --git a/test/disk_tests/usages/lvs b/test/disk_tests/usages/lvs
> index 8d640e1..3720a80 100644
> --- a/test/disk_tests/usages/lvs
> +++ b/test/disk_tests/usages/lvs
> @@ -1,6 +1,6 @@
>  /dev/sdg(0);osd-block-01234;ceph.osd_id=1
>  /dev/sdh(0);osd-journal-01234;ceph.osd_id=1
>  /dev/sdi(0);osd-db-01234;ceph.osd_id=1,dasdf
> -/dev/sdj(0);osd-data-01234;ceph.osd_id=0,asfd
> +/dev/sdj(0);osd-data-01234;ceph.osd_id=0,asfd,ceph.encrypted=1
>  /dev/sdk(0);osd-data-231231;ceph.osd_id=230,ceph.fsid=test
>  /dev/sdl(0);osd-data-234132;ceph.osd_id=,bar
> -- 
> 2.20.1
> 
> 
> _______________________________________________
> pve-devel mailing list
> pve-devel at pve.proxmox.com
> https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel




More information about the pve-devel mailing list