]> git.proxmox.com Git - pve-storage.git/commitdiff
disable jewel image features when using krdb
authorFabian Grünbichler <f.gruenbichler@proxmox.com>
Tue, 7 Jun 2016 06:45:43 +0000 (08:45 +0200)
committerDietmar Maurer <dietmar@proxmox.com>
Tue, 7 Jun 2016 08:25:36 +0000 (10:25 +0200)
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.

PVE/Storage/RBDPlugin.pm

index 2b4ff9c1222b26975ee6e923226541bc25f37695..f208374038c798be9acdd8ab566ff7b04f2949c5 100644 (file)
@@ -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;
 }