disable jewel image features when using krdb
otherwise mapping those images will fail. disabling the features only needs to be done once per image, so it makes sense to do this when creating the images. unfortunately, the command does not work in hammer, so it needs a version check for jewel or higher.
This commit is contained in:
committed by
Dietmar Maurer
parent
7aeda03306
commit
d86fd0a49b
@ -79,6 +79,19 @@ my $rados_cmd = sub {
|
||||
return $cmd;
|
||||
};
|
||||
|
||||
# needed for volumes created using ceph jewel (or higher)
|
||||
my $krdb_feature_disable = sub {
|
||||
my ($scfg, $storeid, $name) = @_;
|
||||
|
||||
return 1 if !$scfg->{krbd};
|
||||
|
||||
my ($major, undef, undef, undef) = ceph_version();
|
||||
return 1 if $major < 10;
|
||||
|
||||
my $feature_cmd = &$rbd_cmd($scfg, $storeid, 'feature', 'disable', $name, 'deep-flatten,fast-diff,object-map,exclusive-lock');
|
||||
run_rbd_command($feature_cmd, errmsg => "could not disable krbd-incompatible image features of rbd volume $name");
|
||||
};
|
||||
|
||||
my $ceph_version_parser = sub {
|
||||
my $line = shift;
|
||||
if ($line =~ m/^ceph version ((\d+)\.(\d+)\.(\d+))(?: \([a-fA-F0-9]+\))?$/) {
|
||||
@ -404,6 +417,8 @@ sub clone_image {
|
||||
|
||||
run_rbd_command($cmd, errmsg => "rbd clone '$basename' error");
|
||||
|
||||
&$krdb_feature_disable($scfg, $storeid, $name);
|
||||
|
||||
return $newvol;
|
||||
}
|
||||
|
||||
@ -419,6 +434,8 @@ sub alloc_image {
|
||||
my $cmd = &$rbd_cmd($scfg, $storeid, 'create', '--image-format' , 2, '--size', int(($size+1023)/1024), $name);
|
||||
run_rbd_command($cmd, errmsg => "rbd create $name' error");
|
||||
|
||||
&$krdb_feature_disable($scfg, $storeid, $name);
|
||||
|
||||
return $name;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user