mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-12-18 11:00:25 +00:00
cephfs: implement resizeVolume() with go-ceph
Reduce the number of calls to the `ceph fs` executable to improve performance of CephFS volume resizing. Signed-off-by: Niels de Vos <ndevos@redhat.com>
This commit is contained in:
parent
d431402101
commit
5baed6190c
@ -20,7 +20,6 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"path"
|
"path"
|
||||||
"strconv"
|
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/ceph/ceph-csi/internal/util"
|
"github.com/ceph/ceph-csi/internal/util"
|
||||||
@ -188,26 +187,13 @@ func (vo *volumeOptions) resizeVolume(ctx context.Context, cr *util.Credentials,
|
|||||||
// resize subvolume when either it's supported, or when corresponding
|
// resize subvolume when either it's supported, or when corresponding
|
||||||
// clusterID key was not present.
|
// clusterID key was not present.
|
||||||
if clusterAdditionalInfo[vo.ClusterID].resizeSupported || !keyPresent {
|
if clusterAdditionalInfo[vo.ClusterID].resizeSupported || !keyPresent {
|
||||||
args := []string{
|
fsa, err := vo.conn.GetFSAdmin()
|
||||||
"fs",
|
if err != nil {
|
||||||
"subvolume",
|
util.ErrorLog(ctx, "could not get FSAdmin, can not resize volume %s:", vo.FsName, err)
|
||||||
"resize",
|
return err
|
||||||
vo.FsName,
|
|
||||||
string(volID),
|
|
||||||
strconv.FormatInt(bytesQuota, 10),
|
|
||||||
"--group_name",
|
|
||||||
vo.SubvolumeGroup,
|
|
||||||
"-m", vo.Monitors,
|
|
||||||
"-c", util.CephConfigPath,
|
|
||||||
"-n", cephEntityClientPrefix + cr.ID,
|
|
||||||
"--keyfile=" + cr.KeyFile,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
err := execCommandErr(
|
_, err = fsa.ResizeSubVolume(vo.FsName, vo.SubvolumeGroup, string(volID), fsAdmin.ByteCount(bytesQuota), true)
|
||||||
ctx,
|
|
||||||
"ceph",
|
|
||||||
args[:]...)
|
|
||||||
|
|
||||||
if err == nil {
|
if err == nil {
|
||||||
clusterAdditionalInfo[vo.ClusterID].resizeSupported = true
|
clusterAdditionalInfo[vo.ClusterID].resizeSupported = true
|
||||||
return nil
|
return nil
|
||||||
|
Loading…
Reference in New Issue
Block a user