mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-24 16:03:43 +08:00
Merge pull request #14952 from wanyaoqi/fix/check-existing-path
fix(region): format and check existing path
This commit is contained in:
@@ -19,6 +19,7 @@ import (
|
||||
"database/sql"
|
||||
"fmt"
|
||||
"path"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
@@ -1884,6 +1885,13 @@ func parseDiskInfo(ctx context.Context, userCred mcclient.TokenCredential, info
|
||||
}
|
||||
}
|
||||
}
|
||||
if info.ExistingPath != "" {
|
||||
info.ExistingPath = strings.TrimSpace(info.ExistingPath)
|
||||
_, err := filepath.Rel("/", info.ExistingPath)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "invaild existing path")
|
||||
}
|
||||
}
|
||||
// XXX: do not set default disk size here, set it by each hypervisor driver
|
||||
// if len(diskConfig.ImageId) > 0 && diskConfig.SizeMb == 0 {
|
||||
// diskConfig.SizeMb = options.Options.DefaultDiskSize // MB
|
||||
|
||||
Reference in New Issue
Block a user