mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-19 02:37:24 +08:00
Merge branch 'release/2.5.0' of ssh://git.yunion.io/~qiujian/onecloud into hotfix/qj-resolve-conflict-2.6.0-20190214
Conflicts: Gopkg.lock
This commit is contained in:
Generated
+4
-4
@@ -1676,7 +1676,7 @@
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
digest = "1:d6ade8116269bb2ef419e7e16e109c1316821e067823794a9470c65b1340705f"
|
||||
digest = "1:6277045f9c9a63d84e1aa48c7ad3c1f42ea6523bc54ea92e772d541c78e37404"
|
||||
name = "yunion.io/x/pkg"
|
||||
packages = [
|
||||
"gotypes",
|
||||
@@ -1710,7 +1710,7 @@
|
||||
"utils",
|
||||
]
|
||||
pruneopts = "UT"
|
||||
revision = "4d8dfcd77e8817d5dc37eacf4b6b098429c7d259"
|
||||
revision = "e2e42205d868c26829b9322b40cdc48f24fed379"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
@@ -1722,11 +1722,11 @@
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
digest = "1:6ea9ac8f317e7dd79309bb1633642bc9d1822011c5175bd241552534d216ac6d"
|
||||
digest = "1:3d0328d99a24ded8844a4e4115692f22dbaeabf03942b03c4bf03d741e103483"
|
||||
name = "yunion.io/x/structarg"
|
||||
packages = ["."]
|
||||
pruneopts = "UT"
|
||||
revision = "e4f0f5201b4acad185ebfb76e65905fe5ae7c1b1"
|
||||
revision = "a4ab4a4d0a3e4e99a8a230fce57f4eb1e177f039"
|
||||
|
||||
[solve-meta]
|
||||
analyzer-name = "dep"
|
||||
|
||||
@@ -251,16 +251,17 @@ func init() {
|
||||
ID string `help:"Image ID or name"`
|
||||
}
|
||||
|
||||
R(&ImageDetailOptions{}, "image-delete", "Delete a image", func(s *mcclient.ClientSession, args *ImageDetailOptions) error {
|
||||
imgID, err := modules.Images.GetId(s, args.ID, nil)
|
||||
type ImageDeleteOptions struct {
|
||||
ID []string `help:"Image ID or name"`
|
||||
OverridePendingDelete *bool `help:"Delete image directly instead of pending delete"`
|
||||
}
|
||||
R(&ImageDeleteOptions{}, "image-delete", "Delete a image", func(s *mcclient.ClientSession, args *ImageDeleteOptions) error {
|
||||
params, err := options.StructToParams(args)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if result, err := modules.Images.Delete(s, imgID, nil); err != nil {
|
||||
return err
|
||||
} else {
|
||||
printObject(result)
|
||||
}
|
||||
ret := modules.Images.BatchDeleteWithParam(s, args.ID, params, nil)
|
||||
printBatchResults(ret, modules.Images.GetColumns(s))
|
||||
return nil
|
||||
})
|
||||
|
||||
|
||||
@@ -121,6 +121,8 @@ func ParseOptions(optStruct interface{}, args []string, configFileName string, s
|
||||
}
|
||||
}
|
||||
|
||||
parser.SetDefault()
|
||||
|
||||
if len(optionsRef.ApplicationID) == 0 {
|
||||
optionsRef.ApplicationID = serviceName
|
||||
}
|
||||
|
||||
@@ -533,7 +533,7 @@ func (self *SImage) CustomizeDelete(ctx context.Context, userCred mcclient.Token
|
||||
overridePendingDelete = jsonutils.QueryBoolean(query, "override_pending_delete", false)
|
||||
purge = jsonutils.QueryBoolean(query, "purge", false)
|
||||
}
|
||||
if self.Status != IMAGE_STATUS_ACTIVE {
|
||||
if self.Status != IMAGE_STATUS_ACTIVE && self.Status != IMAGE_STATUS_CONVERTING {
|
||||
overridePendingDelete = true
|
||||
}
|
||||
return self.startDeleteImageTask(ctx, userCred, "", purge, overridePendingDelete)
|
||||
@@ -827,6 +827,7 @@ func (self *SImage) MakeSubImages() error {
|
||||
if self.GetImageType() == ImageTypeISO {
|
||||
return nil
|
||||
}
|
||||
log.Debugf("[MakeSubImages] convert image to %#v", options.Options.TargetImageFormats)
|
||||
for _, format := range options.Options.TargetImageFormats {
|
||||
if !qemuimg.IsSupportedImageFormat(format) {
|
||||
continue
|
||||
@@ -848,6 +849,9 @@ func (self *SImage) MakeSubImages() error {
|
||||
func (self *SImage) ConvertAllSubformats() error {
|
||||
subimgs := ImageSubformatManager.GetAllSubImages(self.Id)
|
||||
for i := 0; i < len(subimgs); i += 1 {
|
||||
if !utils.IsInStringArray(subimgs[i].Format, options.Options.TargetImageFormats) {
|
||||
continue
|
||||
}
|
||||
err := subimgs[i].DoConvert(self)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -1016,7 +1020,7 @@ func (self *SImage) DoCheckStatus(ctx context.Context, userCred mcclient.TokenCr
|
||||
}
|
||||
for i := 0; i < len(subimgs); i += 1 {
|
||||
subimgs[i].checkStatus(useFast)
|
||||
if subimgs[i].Status != IMAGE_STATUS_ACTIVE || subimgs[i].TorrentStatus != IMAGE_STATUS_ACTIVE {
|
||||
if (subimgs[i].Status != IMAGE_STATUS_ACTIVE || subimgs[i].TorrentStatus != IMAGE_STATUS_ACTIVE) && utils.IsInStringArray(subimgs[i].Format, options.Options.TargetImageFormats) {
|
||||
needConvert = true
|
||||
}
|
||||
}
|
||||
|
||||
+6
-2
@@ -20,13 +20,15 @@ func isLowerChar(ch byte) bool {
|
||||
func CamelSplit(str string, sep string) string {
|
||||
tokens := make([]string, 0)
|
||||
var buf bytes.Buffer
|
||||
upperCount := 0
|
||||
for i := 0; i < len(str); i++ {
|
||||
c := str[i]
|
||||
split := false
|
||||
var nchar byte
|
||||
if isUpperChar(c) {
|
||||
if i > 0 && isUpperChar(str[i-1]) {
|
||||
if i+1 < len(str) && isLowerChar(str[i+1]) {
|
||||
upperCount += 1
|
||||
if upperCount > 1 {
|
||||
if i+1 < len(str) && isLowerChar(str[i+1]) && upperCount > 2 {
|
||||
split = true
|
||||
}
|
||||
} else {
|
||||
@@ -35,7 +37,9 @@ func CamelSplit(str string, sep string) string {
|
||||
nchar = c - 'A' + 'a'
|
||||
} else if isLowerChar(c) {
|
||||
nchar = c
|
||||
upperCount = 0
|
||||
} else {
|
||||
upperCount = 0
|
||||
split = true
|
||||
}
|
||||
if split && buf.Len() > 0 {
|
||||
|
||||
+2
@@ -106,6 +106,8 @@ if e != nil {
|
||||
panic(e)
|
||||
}
|
||||
|
||||
parser.SetDefault() // set default values
|
||||
|
||||
options := parser.Options().(*Options)
|
||||
|
||||
// then access argument values via options
|
||||
|
||||
+2
-2
@@ -382,7 +382,7 @@ func (this *ArgumentParser) AddArgument(arg Argument) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (this *ArgumentParser) setDefault() {
|
||||
func (this *ArgumentParser) SetDefault() {
|
||||
for _, arg := range this.posArgs {
|
||||
arg.SetDefault()
|
||||
}
|
||||
@@ -866,7 +866,7 @@ func (this *ArgumentParser) ParseArgs(args []string, ignore_unknown bool) error
|
||||
if err == nil {
|
||||
err = this.Validate()
|
||||
}
|
||||
this.setDefault()
|
||||
// this.setDefault()
|
||||
return err
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user