fix: bucket GetShortDesc includes cloudproviderinfo

This commit is contained in:
Qiu Jian
2019-08-12 10:00:10 +08:00
parent e72390f7b6
commit 963af1311a
2 changed files with 17 additions and 2 deletions
+12 -2
View File
@@ -151,8 +151,18 @@ func init() {
return doComputeEventList(s, &nargs)
})
R(&TypeEventListOptions{}, "vcenter-event", "Show operation event logs of vcenter", func(s *mcclient.ClientSession, args *TypeEventListOptions) error {
nargs := EventListOptions{BaseEventListOptions: args.BaseEventListOptions, Id: args.ID, Type: []string{"vcenter"}}
R(&TypeEventListOptions{}, "cloud-provider-event", "Show operation event logs of cloudprovider", func(s *mcclient.ClientSession, args *TypeEventListOptions) error {
nargs := EventListOptions{BaseEventListOptions: args.BaseEventListOptions, Id: args.ID, Type: []string{"cloudprovider"}}
return doComputeEventList(s, &nargs)
})
R(&TypeEventListOptions{}, "cloud-account-event", "Show operation event logs of cloudaccount", func(s *mcclient.ClientSession, args *TypeEventListOptions) error {
nargs := EventListOptions{BaseEventListOptions: args.BaseEventListOptions, Id: args.ID, Type: []string{"cloudaccount"}}
return doComputeEventList(s, &nargs)
})
R(&TypeEventListOptions{}, "bucket-event", "Show operation event logs of bucket", func(s *mcclient.ClientSession, args *TypeEventListOptions) error {
nargs := EventListOptions{BaseEventListOptions: args.BaseEventListOptions, Id: args.ID, Type: []string{"bucket"}}
return doComputeEventList(s, &nargs)
})
+5
View File
@@ -213,10 +213,15 @@ func (bucket *SBucket) getStats() cloudprovider.SBucketStats {
func (bucket *SBucket) GetShortDesc(ctx context.Context) *jsonutils.JSONDict {
desc := bucket.SVirtualResourceBase.GetShortDesc(ctx)
desc.Add(jsonutils.NewInt(bucket.SizeBytes), "size_bytes")
desc.Add(jsonutils.NewInt(int64(bucket.ObjectCnt)), "object_cnt")
desc.Add(jsonutils.NewString(bucket.Acl), "acl")
desc.Add(jsonutils.NewString(bucket.StorageClass), "storage_class")
info := bucket.getCloudProviderInfo()
desc.Update(jsonutils.Marshal(&info))
return desc
}