mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-24 16:03:43 +08:00
Merge pull request #2100 from tb365/bugfix/tb-bugfix-0802
huawei & elb bugfix
This commit is contained in:
@@ -72,6 +72,10 @@ func (self *SAwsGuestDriver) IsNeedInjectPasswordByCloudInit(desc *cloudprovider
|
||||
|
||||
func (self *SAwsGuestDriver) GetLinuxDefaultAccount(desc cloudprovider.SManagedVMCreateConfig) string {
|
||||
// return fetchAwsUserName(desc)
|
||||
if desc.OsType == "Windows" {
|
||||
return "Administrator"
|
||||
}
|
||||
|
||||
return api.VM_AWS_DEFAULT_LOGIN_USER
|
||||
}
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@ import (
|
||||
"yunion.io/x/pkg/utils"
|
||||
|
||||
api "yunion.io/x/onecloud/pkg/apis/compute"
|
||||
"yunion.io/x/onecloud/pkg/cloudprovider"
|
||||
"yunion.io/x/onecloud/pkg/compute/models"
|
||||
)
|
||||
|
||||
@@ -89,6 +90,14 @@ func (self *SUCloudGuestDriver) ValidateResizeDisk(guest *models.SGuest, disk *m
|
||||
return nil
|
||||
}
|
||||
|
||||
func (self *SUCloudGuestDriver) GetLinuxDefaultAccount(desc cloudprovider.SManagedVMCreateConfig) string {
|
||||
if desc.OsType == "Windows" {
|
||||
return "Administrator"
|
||||
}
|
||||
|
||||
return "root"
|
||||
}
|
||||
|
||||
func init() {
|
||||
driver := SUCloudGuestDriver{}
|
||||
models.RegisterGuestDriver(&driver)
|
||||
|
||||
@@ -160,7 +160,7 @@ func loadbalancerAclsValidateAclEntries(data *jsonutils.JSONDict, update bool) (
|
||||
|
||||
func (man *SLoadbalancerAclManager) FetchByFingerPrint(fingerprint string) (*SLoadbalancerAcl, error) {
|
||||
ret := &SLoadbalancerAcl{}
|
||||
q := man.Query().IsFalse("pending_deletetd")
|
||||
q := man.Query().IsFalse("pending_deleted")
|
||||
q = q.Equals("fingerprint", fingerprint).Asc("created_at").Limit(1)
|
||||
err := q.First(ret)
|
||||
if err != nil {
|
||||
@@ -171,7 +171,7 @@ func (man *SLoadbalancerAclManager) FetchByFingerPrint(fingerprint string) (*SLo
|
||||
}
|
||||
|
||||
func (man *SLoadbalancerAclManager) CountByFingerPrint(fingerprint string) int {
|
||||
q := man.Query().IsFalse("pending_deletetd")
|
||||
q := man.Query().IsFalse("pending_deleted")
|
||||
return q.Equals("fingerprint", fingerprint).Asc("created_at").Count()
|
||||
}
|
||||
|
||||
|
||||
@@ -208,6 +208,11 @@ func (man *SLoadbalancerCertificateManager) ListItemFilter(ctx context.Context,
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if jsonutils.QueryBoolean(query, "usable", false) {
|
||||
q = q.IsNotEmpty("certificate").IsNotEmpty("private_key")
|
||||
}
|
||||
|
||||
return q, nil
|
||||
}
|
||||
|
||||
|
||||
@@ -763,6 +763,7 @@ func (lblis *SLoadbalancerListener) constructFieldsFromCloudListener(userCred mc
|
||||
lblis.HealthCheckTimeout = extListener.GetHealthCheckTimeout()
|
||||
lblis.HealthCheckInterval = extListener.GetHealthCheckInterval()
|
||||
lblis.HealthCheckRise = extListener.GetHealthCheckRise()
|
||||
lblis.HealthCheckFall = extListener.GetHealthCheckFail()
|
||||
}
|
||||
|
||||
lblis.BackendServerPort = extListener.GetBackendServerPort()
|
||||
@@ -821,9 +822,9 @@ func (lblis *SLoadbalancerListener) constructFieldsFromCloudListener(userCred mc
|
||||
group, err := db.FetchByExternalId(AwsCachedLbbgManager, groupId)
|
||||
if err != nil {
|
||||
log.Errorf("Fetch aws loadbalancer backendgroup by external id %s failed: %s", groupId, err)
|
||||
} else {
|
||||
lblis.BackendGroupId = group.(*SAwsCachedLbbg).BackendGroupId
|
||||
}
|
||||
|
||||
lblis.BackendGroupId = group.(*SAwsCachedLbbg).BackendGroupId
|
||||
}
|
||||
} else if group, err := db.FetchByExternalId(LoadbalancerBackendGroupManager, groupId); err == nil {
|
||||
lblis.BackendGroupId = group.GetId()
|
||||
|
||||
@@ -581,8 +581,8 @@ func (self *SAwsRegionDriver) ValidateCreateLoadbalancerListenerRuleData(ctx con
|
||||
}
|
||||
|
||||
// check backend group protocol http & https
|
||||
data.Remove("domain")
|
||||
data.Remove("path")
|
||||
// data.Remove("domain")
|
||||
// data.Remove("path")
|
||||
data.Set("condition", jsonutils.NewString(condition))
|
||||
data.Set("cloudregion_id", jsonutils.NewString(listener.CloudregionId))
|
||||
data.Set("manager_id", jsonutils.NewString(listener.ManagerId))
|
||||
|
||||
@@ -478,6 +478,11 @@ func (self *SRegion) CreateDisk(zoneId string, category string, name string, siz
|
||||
if len(snapshotId) > 0 {
|
||||
params.SetSnapshotId(snapshotId)
|
||||
}
|
||||
|
||||
if category == api.STORAGE_IO1_SSD {
|
||||
params.SetIops(200)
|
||||
}
|
||||
|
||||
params.SetTagSpecifications([]*ec2.TagSpecification{ec2Tags})
|
||||
|
||||
ret, err := self.ec2Client.CreateVolume(params)
|
||||
|
||||
@@ -166,6 +166,7 @@ func (self *SElbBackendGroup) GetHealthCheck() (*cloudprovider.SLoadbalancerHeal
|
||||
health := &cloudprovider.SLoadbalancerHealthCheck{}
|
||||
health.HealthCheck = api.LB_BOOL_ON
|
||||
health.HealthCheckRise = self.HealthyThresholdCount
|
||||
health.HealthCheckFail = self.UnhealthyThresholdCount
|
||||
health.HealthCheckInterval = self.HealthCheckIntervalSeconds
|
||||
health.HealthCheckURI = self.HealthCheckPath
|
||||
health.HealthCheckType = self.HealthCheckProtocol
|
||||
|
||||
@@ -83,6 +83,7 @@ type SImage struct {
|
||||
SupportDiskIntensive string `json:"__support_diskintensive"`
|
||||
SupportXENGPUType string `json:"__support_xen_gpu_type"`
|
||||
SupportKVMGPUType string `json:"__support_kvm_gpu_type"`
|
||||
SupportArm string `json:"__support_arm"`
|
||||
}
|
||||
|
||||
func (self *SImage) GetMinRamSizeMb() int {
|
||||
@@ -244,6 +245,10 @@ func excludeImage(image SImage) bool {
|
||||
return true
|
||||
}
|
||||
|
||||
if len(image.SupportArm) > 0 {
|
||||
return true
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
|
||||
@@ -16,10 +16,11 @@ package ucloud
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"math/rand"
|
||||
"net"
|
||||
"strconv"
|
||||
"strings"
|
||||
"yunion.io/x/pkg/util/stringutils"
|
||||
"time"
|
||||
|
||||
"yunion.io/x/jsonutils"
|
||||
"yunion.io/x/log"
|
||||
@@ -188,11 +189,19 @@ func (self *SRegion) GetSecurityGroupById(secGroupId string) (*SSecurityGroup, e
|
||||
}
|
||||
}
|
||||
|
||||
func (self *SRegion) CreateDefaultSecurityGroup(name, description string) (string, error) {
|
||||
if strings.ToLower(name) == "default" {
|
||||
// 避免与default安全组名称冲突
|
||||
name = name + stringutils.UUID4()
|
||||
func randomString(prefix string, length int) string {
|
||||
bytes := []byte("0123456789abcdefghijklmnopqrstuvwxyz")
|
||||
result := []byte{}
|
||||
r := rand.New(rand.NewSource(time.Now().UnixNano()))
|
||||
for i := 0; i < length; i++ {
|
||||
result = append(result, bytes[r.Intn(len(bytes))])
|
||||
}
|
||||
return prefix + string(result)
|
||||
}
|
||||
|
||||
func (self *SRegion) CreateDefaultSecurityGroup(name, description string) (string, error) {
|
||||
// 减少安全组名称冲突
|
||||
name = randomString(name, 4)
|
||||
return self.CreateSecurityGroup(name, description, []string{"TCP|1-65535|0.0.0.0/0|ACCEPT|LOW", "UDP|1-65535|0.0.0.0/0|ACCEPT|LOW", "ICMP||0.0.0.0/0|ACCEPT|LOW"})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user