mirror of
https://hubproxy.babadafafafafa.cn/https://github.com/yunionio/cloudpods.git
synced 2026-09-21 00:24:07 +08:00
Compare commits
16 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6ccfcbf0da | ||
|
|
22a5b36817 | ||
|
|
8da358513a | ||
|
|
754c2e62ee | ||
|
|
c6e99bf802 | ||
|
|
92d4e3cf7a | ||
|
|
3efd579564 | ||
|
|
4484a2082b | ||
|
|
d2cfe35296 | ||
|
|
f548d76116 | ||
|
|
fbcbe46a8e | ||
|
|
1389d2176e | ||
|
|
64a86f7ccd | ||
|
|
5b5310c6ee | ||
|
|
162dd766ff | ||
|
|
1c7c3e05bd |
3
Makefile
3
Makefile
@@ -329,6 +329,9 @@ image:
|
||||
|
||||
.PHONY: image
|
||||
|
||||
image-telegraf-raid-plugin:
|
||||
VERSION=release-1.6.1 ARCH=all make image telegraf-raid-plugin
|
||||
|
||||
%:
|
||||
@:
|
||||
|
||||
|
||||
@@ -20,9 +20,8 @@ import (
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
|
||||
"yunion.io/x/log"
|
||||
"yunion.io/x/pkg/errors"
|
||||
"yunion.io/x/pkg/tristate"
|
||||
"yunion.io/x/pkg/util/stringutils"
|
||||
"yunion.io/x/pkg/utils"
|
||||
@@ -382,11 +381,18 @@ func (r *HPSARaid) parsePhyDevs(lines []string) error {
|
||||
r.adapters = append(r.adapters, adapter)
|
||||
}
|
||||
}
|
||||
var errs []error
|
||||
for _, a := range r.adapters {
|
||||
if err := a.ParsePhyDevs(); err != nil {
|
||||
return err
|
||||
err := a.ParsePhyDevs()
|
||||
if err != nil {
|
||||
log.Errorf("parse adapter %d fail: %s", a.GetIndex(), err)
|
||||
errs = append(errs, err)
|
||||
}
|
||||
}
|
||||
if len(errs) == len(r.adapters) {
|
||||
// all failed
|
||||
return errors.NewAggregate(errs)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
@@ -1297,6 +1297,12 @@ func (manager *SGuestManager) validateCreateData(
|
||||
|
||||
dataDiskDefs := []*api.DiskConfig{}
|
||||
if sku != nil && sku.AttachedDiskCount > 0 {
|
||||
if sku.AttachedDiskSizeGB == 0 {
|
||||
return nil, httperrors.NewInputParameterError("sku %s not indicate attached disk size", sku.Name)
|
||||
}
|
||||
if len(sku.AttachedDiskType) == 0 {
|
||||
return nil, httperrors.NewInputParameterError("sku %s not indicate attached disk backend", sku.Name)
|
||||
}
|
||||
for i := 0; i < sku.AttachedDiskCount; i += 1 {
|
||||
dataDisk := &api.DiskConfig{
|
||||
SizeMb: sku.AttachedDiskSizeGB * 1024,
|
||||
@@ -2671,6 +2677,7 @@ func (manager *SGuestManager) newCloudVM(ctx context.Context, userCred mcclient.
|
||||
return nil, err
|
||||
}
|
||||
|
||||
syncVirtualResourceMetadata(ctx, userCred, &guest, extVM)
|
||||
SyncCloudProject(userCred, &guest, syncOwnerId, extVM, host.ManagerId)
|
||||
|
||||
db.OpsLog.LogEvent(&guest, db.ACT_CREATE, guest.GetShortDesc(ctx), userCred)
|
||||
|
||||
@@ -317,11 +317,7 @@ func (man *SCachedLoadbalancerCertificateManager) newFromCloudLoadbalancerCertif
|
||||
lbcert.ManagerId = provider.Id
|
||||
lbcert.CloudregionId = region.Id
|
||||
|
||||
c := SLoadbalancerCertificate{}
|
||||
q1 := LoadbalancerCertificateManager.Query().IsFalse("pending_deleted")
|
||||
q1 = q1.Equals("fingerprint", extCertificate.GetFingerprint())
|
||||
q1 = q1.Equals("tenant_id", provider.ProjectId)
|
||||
err = q1.First(&c)
|
||||
c, err := LoadbalancerCertificateManager.GetLbCertByFingerprint(provider.ProjectId, extCertificate.GetFingerprint())
|
||||
if err != nil {
|
||||
switch err {
|
||||
case sql.ErrNoRows:
|
||||
@@ -360,6 +356,23 @@ func (lbcert *SCachedLoadbalancerCertificate) SyncWithCloudLoadbalancerCertifica
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// update local lb cert
|
||||
localCert, err := LoadbalancerCertificateManager.GetLbCertByFingerprint(projectId.GetProjectId(), extCertificate.GetFingerprint())
|
||||
if err == nil && !localCert.IsComplete() {
|
||||
pkey := extCertificate.GetPrivateKey()
|
||||
cert := extCertificate.GetPublickKey()
|
||||
if len(pkey) > 0 && len(cert) > 0 {
|
||||
_, err = db.UpdateWithLock(ctx, localCert, func() error {
|
||||
localCert.Certificate = cert
|
||||
localCert.PrivateKey = pkey
|
||||
return nil
|
||||
})
|
||||
if err != nil {
|
||||
log.Errorf("SyncWithCloudLoadbalancerCertificate.Update.localcert %s %s", localCert.Id, err)
|
||||
}
|
||||
}
|
||||
}
|
||||
db.OpsLog.LogSyncUpdate(lbcert, diff, userCred)
|
||||
|
||||
SyncCloudProject(userCred, lbcert, projectId, extCertificate, lbcert.ManagerId)
|
||||
|
||||
@@ -478,3 +478,16 @@ func (manager *SLoadbalancerCertificateManager) GetResourceCount() ([]db.SScopeR
|
||||
virts := manager.Query().IsFalse("pending_deleted")
|
||||
return db.CalculateResourceCount(virts, "tenant_id")
|
||||
}
|
||||
|
||||
func (manager *SLoadbalancerCertificateManager) GetLbCertByFingerprint(tenantId, fingerprint string) (*SLoadbalancerCertificate, error) {
|
||||
c := SLoadbalancerCertificate{}
|
||||
c.SetModelManager(manager, &c)
|
||||
q1 := LoadbalancerCertificateManager.Query().IsFalse("pending_deleted")
|
||||
q1 = q1.Equals("fingerprint", fingerprint)
|
||||
q1 = q1.Equals("tenant_id", tenantId)
|
||||
if err := q1.First(&c); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &c, nil
|
||||
}
|
||||
|
||||
@@ -210,7 +210,7 @@ func (self *GuestDeleteTask) OnSyncConfigComplete(ctx context.Context, obj db.IS
|
||||
guest.DetachScheduledTask(ctx, self.UserCred)
|
||||
guestStatus, _ := self.Params.GetString("guest_status")
|
||||
if !utils.IsInStringArray(guestStatus, []string{
|
||||
api.VM_SCHEDULE_FAILED, api.VM_NETWORK_FAILED, api.VM_DISK_FAILED,
|
||||
api.VM_SCHEDULE_FAILED, api.VM_NETWORK_FAILED,
|
||||
api.VM_CREATE_FAILED, api.VM_DEVICE_FAILED}) {
|
||||
self.StartPendingDeleteGuest(ctx, guest)
|
||||
return
|
||||
|
||||
@@ -489,11 +489,25 @@ func newQueryCondition(model *monitor.AlertCondition, index int) (*QueryConditio
|
||||
operator = "and"
|
||||
}
|
||||
cond.Operator = operator
|
||||
|
||||
cond.checkGroupByField()
|
||||
cond.setResType()
|
||||
|
||||
return cond, nil
|
||||
}
|
||||
|
||||
func (c *QueryCondition) checkGroupByField() {
|
||||
metricMeasurement, _ := models.MetricMeasurementManager.GetCache().Get(c.Query.Model.Measurement)
|
||||
if metricMeasurement == nil {
|
||||
return
|
||||
}
|
||||
for i, group := range c.Query.Model.GroupBy {
|
||||
if group.Params[0] == "*" {
|
||||
c.Query.Model.GroupBy[i].Params = []string{monitor.MEASUREMENT_TAG_ID[metricMeasurement.ResType]}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (c *QueryCondition) setResType() {
|
||||
var resType = ""
|
||||
if len(c.Query.Model.GroupBy) == 0 {
|
||||
@@ -557,6 +571,7 @@ func (c *QueryCondition) getOnecloudResources() ([]jsonutils.JSONObject, error)
|
||||
allResources, err = ListAllResources(&mc_mds.Buckets, query)
|
||||
case monitor.METRIC_RES_TYPE_CLOUDACCOUNT:
|
||||
query.Remove("status")
|
||||
query.Add(jsonutils.NewBool(true), "enabled")
|
||||
allResources, err = ListAllResources(&mc_mds.Cloudaccounts, query)
|
||||
case monitor.METRIC_RES_TYPE_TENANT:
|
||||
allResources, err = ListAllResources(&mc_mds.Projects, query)
|
||||
|
||||
@@ -91,7 +91,7 @@ type VolumeImageMetadata struct {
|
||||
type SDisk struct {
|
||||
storage *SStorage
|
||||
multicloud.SDisk
|
||||
multicloud.HuaweiTags
|
||||
multicloud.HuaweiDiskTags
|
||||
details *SResourceDetail
|
||||
|
||||
ID string `json:"id"`
|
||||
|
||||
@@ -260,6 +260,22 @@ func (self *HuaweiTags) SetTags(tags map[string]string, replace bool) error {
|
||||
return errors.Wrap(cloudprovider.ErrNotImplemented, "SetTags")
|
||||
}
|
||||
|
||||
type HuaweiDiskTags struct {
|
||||
Tags map[string]string
|
||||
}
|
||||
|
||||
func (self *HuaweiDiskTags) GetTags() (map[string]string, error) {
|
||||
return self.Tags, nil
|
||||
}
|
||||
|
||||
func (self *HuaweiDiskTags) GetSysTags() map[string]string {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (self *HuaweiDiskTags) SetTags(tags map[string]string, replace bool) error {
|
||||
return errors.Wrap(cloudprovider.ErrNotImplemented, "SetTags")
|
||||
}
|
||||
|
||||
type OpenStackTags struct {
|
||||
Metadata map[string]string
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user