move Storage/CephTools to CephConfig
it is not a storage plugin, and it makes more sense to have it top-level, but there we cannot name it CephTools because of the existing ones in pve-manager Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
This commit is contained in:
committed by
Thomas Lamprecht
parent
36d4af9ba8
commit
4050fcc16b
@ -1,4 +1,4 @@
|
|||||||
package PVE::Storage::CephTools;
|
package PVE::CephConfig;
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
use warnings;
|
use warnings;
|
||||||
@ -4,6 +4,7 @@
|
|||||||
install:
|
install:
|
||||||
install -D -m 0644 Storage.pm ${DESTDIR}${PERLDIR}/PVE/Storage.pm
|
install -D -m 0644 Storage.pm ${DESTDIR}${PERLDIR}/PVE/Storage.pm
|
||||||
install -D -m 0644 Diskmanage.pm ${DESTDIR}${PERLDIR}/PVE/Diskmanage.pm
|
install -D -m 0644 Diskmanage.pm ${DESTDIR}${PERLDIR}/PVE/Diskmanage.pm
|
||||||
|
install -D -m 0644 CephConfig.pm ${DESTDIR}${PERLDIR}/PVE/CephConfig.pm
|
||||||
make -C Storage install
|
make -C Storage install
|
||||||
make -C API2 install
|
make -C API2 install
|
||||||
make -C CLI install
|
make -C CLI install
|
||||||
|
|||||||
@ -11,16 +11,16 @@ use PVE::Tools qw(run_command);
|
|||||||
use PVE::ProcFSTools;
|
use PVE::ProcFSTools;
|
||||||
use PVE::Storage::Plugin;
|
use PVE::Storage::Plugin;
|
||||||
use PVE::JSONSchema qw(get_standard_option);
|
use PVE::JSONSchema qw(get_standard_option);
|
||||||
use PVE::Storage::CephTools;
|
use PVE::CephConfig;
|
||||||
|
|
||||||
use base qw(PVE::Storage::Plugin);
|
use base qw(PVE::Storage::Plugin);
|
||||||
|
|
||||||
sub cephfs_is_mounted {
|
sub cephfs_is_mounted {
|
||||||
my ($scfg, $storeid, $mountdata) = @_;
|
my ($scfg, $storeid, $mountdata) = @_;
|
||||||
|
|
||||||
my $cmd_option = PVE::Storage::CephTools::ceph_connect_option($scfg, $storeid);
|
my $cmd_option = PVE::CephConfig::ceph_connect_option($scfg, $storeid);
|
||||||
my $configfile = $cmd_option->{ceph_conf};
|
my $configfile = $cmd_option->{ceph_conf};
|
||||||
my $server = $cmd_option->{mon_host} // PVE::Storage::CephTools::get_monaddr_list($configfile);
|
my $server = $cmd_option->{mon_host} // PVE::CephConfig::get_monaddr_list($configfile);
|
||||||
|
|
||||||
my $subdir = $scfg->{subdir} // '/';
|
my $subdir = $scfg->{subdir} // '/';
|
||||||
my $mountpoint = $scfg->{path};
|
my $mountpoint = $scfg->{path};
|
||||||
@ -46,10 +46,10 @@ sub cephfs_mount {
|
|||||||
my $mountpoint = $scfg->{path};
|
my $mountpoint = $scfg->{path};
|
||||||
my $subdir = $scfg->{subdir} // '/';
|
my $subdir = $scfg->{subdir} // '/';
|
||||||
|
|
||||||
my $cmd_option = PVE::Storage::CephTools::ceph_connect_option($scfg, $storeid);
|
my $cmd_option = PVE::CephConfig::ceph_connect_option($scfg, $storeid);
|
||||||
my $configfile = $cmd_option->{ceph_conf};
|
my $configfile = $cmd_option->{ceph_conf};
|
||||||
my $secretfile = $cmd_option->{keyring};
|
my $secretfile = $cmd_option->{keyring};
|
||||||
my $server = $cmd_option->{mon_host} // PVE::Storage::CephTools::get_monaddr_list($configfile);
|
my $server = $cmd_option->{mon_host} // PVE::CephConfig::get_monaddr_list($configfile);
|
||||||
|
|
||||||
# fuse -> client-enforced quotas (kernel doesn't), updates w/ ceph-fuse pkg
|
# fuse -> client-enforced quotas (kernel doesn't), updates w/ ceph-fuse pkg
|
||||||
# kernel -> better performance, less frequent updates
|
# kernel -> better performance, less frequent updates
|
||||||
@ -137,7 +137,7 @@ sub on_add_hook {
|
|||||||
|
|
||||||
return if defined($scfg->{monhost}); # nothing to do if not pve managed ceph
|
return if defined($scfg->{monhost}); # nothing to do if not pve managed ceph
|
||||||
|
|
||||||
PVE::Storage::CephTools::ceph_create_keyfile($scfg->{type}, $storeid);
|
PVE::CephConfig::ceph_create_keyfile($scfg->{type}, $storeid);
|
||||||
}
|
}
|
||||||
|
|
||||||
sub on_delete_hook {
|
sub on_delete_hook {
|
||||||
@ -145,7 +145,7 @@ sub on_delete_hook {
|
|||||||
|
|
||||||
return if defined($scfg->{monhost}); # nothing to do if not pve managed ceph
|
return if defined($scfg->{monhost}); # nothing to do if not pve managed ceph
|
||||||
|
|
||||||
PVE::Storage::CephTools::ceph_remove_keyfile($scfg->{type}, $storeid);
|
PVE::CephConfig::ceph_remove_keyfile($scfg->{type}, $storeid);
|
||||||
}
|
}
|
||||||
|
|
||||||
sub status {
|
sub status {
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
SOURCES=Plugin.pm DirPlugin.pm LVMPlugin.pm NFSPlugin.pm CIFSPlugin.pm ISCSIPlugin.pm CephFSPlugin.pm RBDPlugin.pm CephTools.pm SheepdogPlugin.pm ISCSIDirectPlugin.pm GlusterfsPlugin.pm ZFSPoolPlugin.pm ZFSPlugin.pm DRBDPlugin.pm LvmThinPlugin.pm
|
SOURCES=Plugin.pm DirPlugin.pm LVMPlugin.pm NFSPlugin.pm CIFSPlugin.pm ISCSIPlugin.pm CephFSPlugin.pm RBDPlugin.pm SheepdogPlugin.pm ISCSIDirectPlugin.pm GlusterfsPlugin.pm ZFSPoolPlugin.pm ZFSPlugin.pm DRBDPlugin.pm LvmThinPlugin.pm
|
||||||
|
|
||||||
.PHONY: install
|
.PHONY: install
|
||||||
install:
|
install:
|
||||||
|
|||||||
@ -8,7 +8,7 @@ use PVE::Tools qw(run_command trim);
|
|||||||
use PVE::Storage::Plugin;
|
use PVE::Storage::Plugin;
|
||||||
use PVE::JSONSchema qw(get_standard_option);
|
use PVE::JSONSchema qw(get_standard_option);
|
||||||
use PVE::RADOS;
|
use PVE::RADOS;
|
||||||
use PVE::Storage::CephTools;
|
use PVE::CephConfig;
|
||||||
use JSON;
|
use JSON;
|
||||||
|
|
||||||
use base qw(PVE::Storage::Plugin);
|
use base qw(PVE::Storage::Plugin);
|
||||||
@ -30,7 +30,7 @@ my $add_pool_to_disk = sub {
|
|||||||
my $build_cmd = sub {
|
my $build_cmd = sub {
|
||||||
my ($binary, $scfg, $storeid, $op, @options) = @_;
|
my ($binary, $scfg, $storeid, $op, @options) = @_;
|
||||||
|
|
||||||
my $cmd_option = PVE::Storage::CephTools::ceph_connect_option($scfg, $storeid);
|
my $cmd_option = PVE::CephConfig::ceph_connect_option($scfg, $storeid);
|
||||||
my $pool = $scfg->{pool} ? $scfg->{pool} : 'rbd';
|
my $pool = $scfg->{pool} ? $scfg->{pool} : 'rbd';
|
||||||
|
|
||||||
my $cmd = [$binary, '-p', $pool];
|
my $cmd = [$binary, '-p', $pool];
|
||||||
@ -63,7 +63,7 @@ my $rados_cmd = sub {
|
|||||||
my $librados_connect = sub {
|
my $librados_connect = sub {
|
||||||
my ($scfg, $storeid, $options) = @_;
|
my ($scfg, $storeid, $options) = @_;
|
||||||
|
|
||||||
my $librados_config = PVE::Storage::CephTools::ceph_connect_option($scfg, $storeid);
|
my $librados_config = PVE::CephConfig::ceph_connect_option($scfg, $storeid);
|
||||||
|
|
||||||
my $rados = PVE::RADOS->new(%$librados_config);
|
my $rados = PVE::RADOS->new(%$librados_config);
|
||||||
|
|
||||||
@ -283,7 +283,7 @@ sub on_add_hook {
|
|||||||
|
|
||||||
return if defined($scfg->{monhost}); # nothing to do if not pve managed ceph
|
return if defined($scfg->{monhost}); # nothing to do if not pve managed ceph
|
||||||
|
|
||||||
PVE::Storage::CephTools::ceph_create_keyfile($scfg->{type}, $storeid);
|
PVE::CephConfig::ceph_create_keyfile($scfg->{type}, $storeid);
|
||||||
}
|
}
|
||||||
|
|
||||||
sub on_delete_hook {
|
sub on_delete_hook {
|
||||||
@ -291,7 +291,7 @@ sub on_delete_hook {
|
|||||||
|
|
||||||
return if defined($scfg->{monhost}); # nothing to do if not pve managed ceph
|
return if defined($scfg->{monhost}); # nothing to do if not pve managed ceph
|
||||||
|
|
||||||
PVE::Storage::CephTools::ceph_remove_keyfile($scfg->{type}, $storeid);
|
PVE::CephConfig::ceph_remove_keyfile($scfg->{type}, $storeid);
|
||||||
}
|
}
|
||||||
|
|
||||||
sub parse_volname {
|
sub parse_volname {
|
||||||
@ -307,7 +307,7 @@ sub parse_volname {
|
|||||||
sub path {
|
sub path {
|
||||||
my ($class, $scfg, $volname, $storeid, $snapname) = @_;
|
my ($class, $scfg, $volname, $storeid, $snapname) = @_;
|
||||||
|
|
||||||
my $cmd_option = PVE::Storage::CephTools::ceph_connect_option($scfg, $storeid);
|
my $cmd_option = PVE::CephConfig::ceph_connect_option($scfg, $storeid);
|
||||||
my ($vtype, $name, $vmid) = $class->parse_volname($volname);
|
my ($vtype, $name, $vmid) = $class->parse_volname($volname);
|
||||||
$name .= '@'.$snapname if $snapname;
|
$name .= '@'.$snapname if $snapname;
|
||||||
|
|
||||||
@ -318,7 +318,7 @@ sub path {
|
|||||||
|
|
||||||
$path .= ":conf=$cmd_option->{ceph_conf}" if $cmd_option->{ceph_conf};
|
$path .= ":conf=$cmd_option->{ceph_conf}" if $cmd_option->{ceph_conf};
|
||||||
if (defined($scfg->{monhost})) {
|
if (defined($scfg->{monhost})) {
|
||||||
my $monhost = PVE::Storage::CephTools::hostlist($scfg->{monhost}, ';');
|
my $monhost = PVE::CephConfig::hostlist($scfg->{monhost}, ';');
|
||||||
$monhost =~ s/:/\\:/g;
|
$monhost =~ s/:/\\:/g;
|
||||||
$path .= ":mon_host=$monhost";
|
$path .= ":mon_host=$monhost";
|
||||||
$path .= ":auth_supported=$cmd_option->{auth_supported}";
|
$path .= ":auth_supported=$cmd_option->{auth_supported}";
|
||||||
|
|||||||
Reference in New Issue
Block a user