mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-19 02:37:24 +08:00
fix(region): esxi vm create with tags (#19262)
This commit is contained in:
@@ -467,6 +467,8 @@ func (self *SESXiGuestDriver) RequestDeployGuestOnHost(ctx context.Context, gues
|
||||
extId = guest.ExternalId
|
||||
}
|
||||
config.Add(jsonutils.NewString(extId), "guest_ext_id")
|
||||
tags, _ := guest.GetAllUserMetadata()
|
||||
config.Set("tags", jsonutils.Marshal(tags))
|
||||
|
||||
account := host.GetCloudaccount()
|
||||
accessInfo, err := account.GetVCenterAccessInfo(storage.ExternalId)
|
||||
|
||||
@@ -170,6 +170,14 @@ func (as *SAgentStorage) agentCreateGuest(ctx context.Context, data *jsonutils.J
|
||||
if err != nil {
|
||||
return false, errors.Wrap(err, "SHost.CreateVM2")
|
||||
}
|
||||
tags := map[string]string{}
|
||||
data.Unmarshal(&tags, "tags")
|
||||
if len(tags) > 0 {
|
||||
err = vm.SetTags(tags, true)
|
||||
if err != nil {
|
||||
log.Warningf("set tags for vm %s error: %v", createParam.Name, err)
|
||||
}
|
||||
}
|
||||
name, _ := descDict.GetString("name")
|
||||
err = as.tryRenameVm(ctx, vm, name)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user