Compare commits

...

16 Commits

Author SHA1 Message Date
yunion-ci-robot
6ccfcbf0da Merge pull request #11312 from ioito/automated-cherry-pick-of-#11311-upstream-release-3.7
Automated cherry pick of #11311: fix(region): huawei disk tags
2021-06-08 10:50:26 +08:00
Zexi Li
22a5b36817 Merge pull request #11333 from ioito/automated-cherry-pick-of-#11332-upstream-release-3.7
Automated cherry pick of #11332: fix(region): validate attached disk size and backend
2021-06-07 17:43:48 +08:00
Zexi Li
8da358513a Merge pull request #11336 from zhaoxiangchun/automated-cherry-pick-of-#11335-upstream-release-3.7
Automated cherry pick of #11335: fix(telegraf-raid-plugin): add image-telegraf-raid-plugin in Makefile
2021-06-07 17:42:38 +08:00
zhaoxiangchun
754c2e62ee fix(telegraf-raid-plugin): add image-telegraf-raid-plugin in Makefile 2021-06-07 16:20:08 +08:00
Qu Xuan
c6e99bf802 fix(region): validate attached disk size and backend 2021-06-07 15:44:18 +08:00
Zexi Li
92d4e3cf7a Merge pull request #11327 from ioito/automated-cherry-pick-of-#11326-upstream-release-3.7
Automated cherry pick of #11326: fix(region): sync tags with new guest
2021-06-06 00:54:42 +08:00
Zexi Li
3efd579564 Merge pull request #11323 from zhaoxiangchun/automated-cherry-pick-of-#11320-upstream-release-3.7
Automated cherry pick of #11320: fix: 修复云账号和宿主机报警问题
2021-06-05 12:16:40 +08:00
Qu Xuan
4484a2082b fix(region): sync tags with new guest 2021-06-04 23:10:20 +08:00
Zexi Li
d2cfe35296 Merge pull request #11298 from tb365/automated-cherry-pick-of-#11297-upstream-release-3.7
Automated cherry pick of #11297: fix(region): lb local cert sync fix
2021-06-04 21:09:54 +08:00
Zexi Li
f548d76116 Merge pull request #11300 from swordqiu/automated-cherry-pick-of-#11299-upstream-release-3.7
Automated cherry pick of #11299: fix: hpssacli should skip empty slots
2021-06-04 21:04:26 +08:00
Zexi Li
fbcbe46a8e Merge pull request #11319 from ioito/automated-cherry-pick-of-#11318-upstream-release-3.7
Automated cherry pick of #11318: fix(region): avoid guest delete not with disks
2021-06-04 19:46:31 +08:00
zhaoxiangchun
1389d2176e fix: 修复云账号和宿主机报警问题
1.云账号报警时过滤掉已经禁用的云账号
2.修复宿主机报警时资源名称重复的问题
2021-06-04 19:24:36 +08:00
Qu Xuan
64a86f7ccd fix(region): avoid guest delete not with disks 2021-06-04 19:17:21 +08:00
Qu Xuan
5b5310c6ee fix(region): huawei disk tags 2021-06-04 14:37:13 +08:00
Qiu Jian
162dd766ff fix: hpssacli should skip empty slots
hpssacli may fail when detect disks on empty slots, which cause raid
detection failure
2021-06-03 19:35:53 +08:00
tb365
1c7c3e05bd fix(region): lb local cert sync fix 2021-06-03 18:51:37 +08:00
9 changed files with 84 additions and 11 deletions

View File

@@ -329,6 +329,9 @@ image:
.PHONY: image
image-telegraf-raid-plugin:
VERSION=release-1.6.1 ARCH=all make image telegraf-raid-plugin
%:
@:

View File

@@ -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
}

View File

@@ -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)

View File

@@ -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)

View File

@@ -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
}

View File

@@ -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

View File

@@ -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)

View File

@@ -91,7 +91,7 @@ type VolumeImageMetadata struct {
type SDisk struct {
storage *SStorage
multicloud.SDisk
multicloud.HuaweiTags
multicloud.HuaweiDiskTags
details *SResourceDetail
ID string `json:"id"`

View File

@@ -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
}