fix #1816: rbd: add support for erasure coded ec pools
The first step is to allocate rbd images correctly. The metadata objects still need to be stored in a replicated pool, but by providing the --data-pool parameter on image creation, we can place the data objects on the erasure coded (EC) pool. Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
This commit is contained in:
committed by
Thomas Lamprecht
parent
05b07a67f5
commit
ef2afce74a
@ -289,6 +289,10 @@ sub properties {
|
|||||||
description => "Pool.",
|
description => "Pool.",
|
||||||
type => 'string',
|
type => 'string',
|
||||||
},
|
},
|
||||||
|
'data-pool' => {
|
||||||
|
description => "Data Pool (for erasure coding only)",
|
||||||
|
type => 'string',
|
||||||
|
},
|
||||||
namespace => {
|
namespace => {
|
||||||
description => "RBD Namespace.",
|
description => "RBD Namespace.",
|
||||||
type => 'string',
|
type => 'string',
|
||||||
@ -318,6 +322,7 @@ sub options {
|
|||||||
disable => { optional => 1 },
|
disable => { optional => 1 },
|
||||||
monhost => { optional => 1},
|
monhost => { optional => 1},
|
||||||
pool => { optional => 1 },
|
pool => { optional => 1 },
|
||||||
|
'data-pool' => { optional => 1 },
|
||||||
namespace => { optional => 1 },
|
namespace => { optional => 1 },
|
||||||
username => { optional => 1 },
|
username => { optional => 1 },
|
||||||
content => { optional => 1 },
|
content => { optional => 1 },
|
||||||
@ -492,15 +497,10 @@ sub clone_image {
|
|||||||
my $newvol = "$basename/$name";
|
my $newvol = "$basename/$name";
|
||||||
$newvol = $name if length($snapname);
|
$newvol = $name if length($snapname);
|
||||||
|
|
||||||
my $cmd = $rbd_cmd->(
|
my @options = ('clone', get_rbd_path($scfg, $basename), '--snap', $snap);
|
||||||
$scfg,
|
push @options, ('--data-pool', $scfg->{'data-pool'}) if $scfg->{'data-pool'};
|
||||||
$storeid,
|
push @options, get_rbd_path($scfg, $name);
|
||||||
'clone',
|
my $cmd = $rbd_cmd->($scfg, $storeid, @options);
|
||||||
get_rbd_path($scfg, $basename),
|
|
||||||
'--snap',
|
|
||||||
$snap,
|
|
||||||
get_rbd_path($scfg, $name),
|
|
||||||
);
|
|
||||||
|
|
||||||
run_rbd_command($cmd, errmsg => "rbd clone '$basename' error");
|
run_rbd_command($cmd, errmsg => "rbd clone '$basename' error");
|
||||||
|
|
||||||
@ -516,7 +516,10 @@ sub alloc_image {
|
|||||||
|
|
||||||
$name = $class->find_free_diskname($storeid, $scfg, $vmid) if !$name;
|
$name = $class->find_free_diskname($storeid, $scfg, $vmid) if !$name;
|
||||||
|
|
||||||
my $cmd = $rbd_cmd->($scfg, $storeid, 'create', '--image-format' , 2, '--size', int(($size+1023)/1024), $name);
|
my @options = ('create', '--image-format' , 2, '--size', int(($size+1023)/1024));
|
||||||
|
push @options, ('--data-pool', $scfg->{'data-pool'}) if $scfg->{'data-pool'};
|
||||||
|
push @options, $name;
|
||||||
|
my $cmd = $rbd_cmd->($scfg, $storeid, @options);
|
||||||
run_rbd_command($cmd, errmsg => "rbd create '$name' error");
|
run_rbd_command($cmd, errmsg => "rbd create '$name' error");
|
||||||
|
|
||||||
return $name;
|
return $name;
|
||||||
|
|||||||
Reference in New Issue
Block a user