mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-24 16:03:43 +08:00
fix: set eipid after successful eip association
This commit is contained in:
@@ -415,7 +415,8 @@ func (group *SGroup) ClearAllScheDescCache() error {
|
||||
|
||||
func (group *SGroup) clearSchedDescCache(hostIds []string) error {
|
||||
var g errgroup.Group
|
||||
for _, hostId := range hostIds {
|
||||
for i := range hostIds {
|
||||
hostId := hostIds[i]
|
||||
g.Go(func() error {
|
||||
return HostManager.ClearSchedDescCache(hostId)
|
||||
})
|
||||
|
||||
@@ -519,9 +519,9 @@ func (guest *SGuest) GetDetailsMakeSshableCmd(
|
||||
}
|
||||
|
||||
varVals := [][2]string{
|
||||
[2]string{"user", "cloudroot"},
|
||||
[2]string{"adminpub", strings.TrimSpace(adminPublicKey)},
|
||||
[2]string{"projpub", strings.TrimSpace(projectPublicKey)},
|
||||
{"user", "cloudroot"},
|
||||
{"adminpub", strings.TrimSpace(adminPublicKey)},
|
||||
{"projpub", strings.TrimSpace(projectPublicKey)},
|
||||
}
|
||||
shellCmd := ""
|
||||
for i := range varVals {
|
||||
|
||||
@@ -1192,7 +1192,7 @@ func (self *SKVMRegionDriver) RequestPreSnapshotPolicyApply(ctx context.Context,
|
||||
}
|
||||
|
||||
func (self *SKVMRegionDriver) ValidateCacheSecgroup(ctx context.Context, userCred mcclient.TokenCredential, secgroup *models.SSecurityGroup, vpc *models.SVpc, classic bool) error {
|
||||
return fmt.Errorf("No need to cache secgroup for onecloud region")
|
||||
return errors.Wrap(httperrors.ErrNotSupported, "No need to cache secgroup for onecloud region")
|
||||
}
|
||||
|
||||
func (self *SKVMRegionDriver) ValidateCreateElasticcacheData(ctx context.Context, userCred mcclient.TokenCredential, ownerId mcclient.IIdentityProvider, input *api.ElasticcacheCreateInput) (*api.ElasticcacheCreateInput, error) {
|
||||
@@ -1397,6 +1397,9 @@ func (self *SKVMRegionDriver) RequestCreateBackup(ctx context.Context, backup *m
|
||||
|
||||
func (self *SKVMRegionDriver) RequestAssociateEip(ctx context.Context, userCred mcclient.TokenCredential, eip *models.SElasticip, input api.ElasticipAssociateInput, obj db.IStatusStandaloneModel, task taskman.ITask) error {
|
||||
taskman.LocalTaskRun(task, func() (jsonutils.JSONObject, error) {
|
||||
if err := eip.AssociateInstance(ctx, userCred, input.InstanceType, obj); err != nil {
|
||||
return nil, errors.Wrapf(err, "associate eip %s(%s) to %s %s(%s)", eip.Name, eip.Id, obj.Keyword(), obj.GetName(), obj.GetId())
|
||||
}
|
||||
switch input.InstanceType {
|
||||
case api.EIP_ASSOCIATE_TYPE_SERVER:
|
||||
err := self.requestAssociateEipWithServer(ctx, userCred, eip, input, obj, task)
|
||||
@@ -1416,11 +1419,8 @@ func (self *SKVMRegionDriver) RequestAssociateEip(ctx context.Context, userCred
|
||||
default:
|
||||
return nil, errors.Wrapf(cloudprovider.ErrNotSupported, "instance type %s", input.InstanceType)
|
||||
}
|
||||
if err := eip.AssociateInstance(ctx, userCred, input.InstanceType, obj); err != nil {
|
||||
return nil, errors.Wrapf(err, "associate eip %s(%s) to %s %s(%s)", eip.Name, eip.Id, obj.Keyword(), obj.GetName(), obj.GetId())
|
||||
}
|
||||
if err := eip.SetStatus(userCred, api.EIP_STATUS_READY, api.EIP_STATUS_ASSOCIATE); err != nil {
|
||||
return nil, errors.Wrapf(err, "set eip status to %s", api.EIP_STATUS_ALLOCATE)
|
||||
return nil, errors.Wrapf(err, "set eip status to %s", api.EIP_STATUS_READY)
|
||||
}
|
||||
return nil, nil
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user