mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-10-28 03:23:25 +08:00
* fix: support default gateway interface * fix: default gateway 2 --------- Co-authored-by: Qiu Jian <qiujian@yunionyun.com>
This commit is contained in:
@@ -44,6 +44,7 @@ func init() {
|
||||
cmd.Perform("set-class-metadata", &options.ResourceMetadataOptions{})
|
||||
cmd.Perform("switch-wire", &compute_options.NetworkSwitchWireOptions{})
|
||||
cmd.Perform("sync-additional-wires", &compute_options.NetworkSyncAdditionalWiresOptions{})
|
||||
cmd.Get("available-addresses", &compute_options.NetworkIdOptions{})
|
||||
|
||||
type NetworkShareOptions struct {
|
||||
ID string `help:"ID or Name of the zone to show"`
|
||||
|
||||
@@ -162,6 +162,18 @@ func init() {
|
||||
return nil
|
||||
})
|
||||
|
||||
type ServiceConfigShow2Options struct {
|
||||
TYPE string `help:"service type"`
|
||||
}
|
||||
R(&ServiceConfigShow2Options{}, "service-config-show2", "Show configs of a service", func(s *mcclient.ClientSession, args *ServiceConfigShow2Options) error {
|
||||
conf, err := modules.ServicesV3.GetConfig(s, args.TYPE)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
fmt.Println(conf.PrettyString())
|
||||
return nil
|
||||
})
|
||||
|
||||
type ServiceConfigOptions struct {
|
||||
SERVICE string `help:"service name or id"`
|
||||
Config []string `help:"config options, can be a JSON, a YAML or a key=value pair, e.g:\n * JSON\n '{\"default\":{\"password_expiration_seconds\":300}}'\n * YAML\n default:\n password_expiration_seconds: 300\n * A key=value pair (under default section)\n password_expiration_seconds=300\n"`
|
||||
|
||||
@@ -96,6 +96,8 @@ type NetworkConfig struct {
|
||||
RxTrafficLimit int64 `json:"rx_traffic_limit"`
|
||||
TxTrafficLimit int64 `json:"tx_traffic_limit"`
|
||||
|
||||
IsDefault bool `json:"is_default"`
|
||||
|
||||
// sriov nic
|
||||
SriovDevice *IsolatedDeviceConfig `json:"sriov_device"`
|
||||
|
||||
@@ -120,6 +122,9 @@ type AttachNetworkInput struct {
|
||||
// 添加的网卡的配置
|
||||
// required: true
|
||||
Nets []*NetworkConfig `json:"nets"`
|
||||
|
||||
// 添加后不立即同步配置
|
||||
DisableSyncConfig *bool `json:"disable_sync_config"`
|
||||
}
|
||||
|
||||
type DiskConfig struct {
|
||||
|
||||
@@ -81,6 +81,8 @@ type GuestnetworkUpdateInput struct {
|
||||
BwLimit *int `json:"bw_limit"`
|
||||
|
||||
Index *int8 `json:"index"`
|
||||
|
||||
IsDefault *bool `json:"is_default"`
|
||||
}
|
||||
|
||||
type GuestnetworkBaseDesc struct {
|
||||
@@ -103,6 +105,9 @@ type GuestnetworkBaseDesc struct {
|
||||
RxTrafficLimit int64 `json:"rx_traffic_limit"`
|
||||
TxTrafficLimit int64 `json:"tx_traffic_limit"`
|
||||
|
||||
// 是否为缺省路由网关
|
||||
IsDefault bool `json:"is_default"`
|
||||
|
||||
Bridge string `json:"bridge"`
|
||||
WireId string `json:"wire_id"`
|
||||
Interface string `json:"interface"`
|
||||
|
||||
@@ -679,6 +679,14 @@ type ServerDetachnetworkInput struct {
|
||||
IpAddr string `json:"ip_addr"`
|
||||
// 通过Mac解绑网卡, 优先级低于ip_addr
|
||||
Mac string `json:"mac"`
|
||||
// 解绑后不立即同步配置
|
||||
DisableSyncConfig *bool `json:"disable_sync_config"`
|
||||
// 强制卸载,无论虚拟机的状态,仅更新数据库
|
||||
Force *bool `json:"force"`
|
||||
}
|
||||
|
||||
func (input ServerDetachnetworkInput) IsForce() bool {
|
||||
return input.Force != nil && *input.Force
|
||||
}
|
||||
|
||||
type ServerMigrateForecastInput struct {
|
||||
|
||||
@@ -432,6 +432,14 @@ type GetNetworkAddressesOutput struct {
|
||||
Addresses []SNetworkUsedAddress `json:"addresses"`
|
||||
}
|
||||
|
||||
type GetNetworkAvailableAddressesInput struct {
|
||||
}
|
||||
|
||||
type GetNetworkAvailableAddressesOutput struct {
|
||||
// IP子网地址记录
|
||||
Addresses []string `json:"addresses"`
|
||||
}
|
||||
|
||||
type NetworkSetBgpTypeInput struct {
|
||||
apis.Meta
|
||||
|
||||
|
||||
@@ -69,7 +69,7 @@ func (s *BaremetalService) StartService() {
|
||||
log.Infof("auth complete")
|
||||
})
|
||||
|
||||
fsdriver.Init(nil, "")
|
||||
fsdriver.Init("")
|
||||
app := app_common.InitApp(&o.Options.BaseOptions, false)
|
||||
|
||||
common_options.StartOptionManager(&o.Options, o.Options.ConfigSyncPeriodSeconds, api.SERVICE_TYPE, api.SERVICE_VERSION, o.OnOptionsChange)
|
||||
|
||||
@@ -279,6 +279,8 @@ func ParseNetworkConfig(desc string, idx int) (*compute.NetworkConfig, error) {
|
||||
netConfig.RequireTeaming = true
|
||||
} else if p == "[try-teaming]" {
|
||||
netConfig.TryTeaming = true
|
||||
} else if p == "[defaultgw]" {
|
||||
netConfig.IsDefault = true
|
||||
} else if strings.HasPrefix(p, "standby-port=") {
|
||||
netConfig.StandbyPortCount, _ = strconv.Atoi(p[len("standby-port="):])
|
||||
} else if strings.HasPrefix(p, "standby-addr=") {
|
||||
|
||||
@@ -80,17 +80,19 @@ func (s *mcclientServiceConfigSession) Merge(opts interface{}, serviceType strin
|
||||
region, _ := s.config.GetString("region")
|
||||
// epType, _ := s.config.GetString("session_endpoint_type")
|
||||
s.session = auth.GetAdminSession(context.Background(), region)
|
||||
s.serviceId, _ = getServiceIdByType(s.session, serviceType, serviceVersion)
|
||||
if len(s.serviceId) > 0 {
|
||||
serviceConf, err := getServiceConfig(s.session, s.serviceId)
|
||||
if err != nil {
|
||||
log.Errorf("getServiceConfig for %s failed: %s", serviceType, err)
|
||||
} else if serviceConf != nil {
|
||||
s.config.Update(serviceConf)
|
||||
merged = true
|
||||
} else {
|
||||
// not initialized
|
||||
// s.Upload()
|
||||
if len(serviceType) > 0 {
|
||||
s.serviceId, _ = getServiceIdByType(s.session, serviceType, serviceVersion)
|
||||
if len(s.serviceId) > 0 {
|
||||
serviceConf, err := getServiceConfig(s.session, s.serviceId)
|
||||
if err != nil {
|
||||
log.Errorf("getServiceConfig for %s failed: %s", serviceType, err)
|
||||
} else if serviceConf != nil {
|
||||
s.config.Update(serviceConf)
|
||||
merged = true
|
||||
} else {
|
||||
// not initialized
|
||||
// s.Upload()
|
||||
}
|
||||
}
|
||||
}
|
||||
s.commonServiceId, _ = getServiceIdByType(s.session, consts.COMMON_SERVICE, "")
|
||||
|
||||
@@ -82,6 +82,8 @@ type SServerNic struct {
|
||||
Ifname string `json:"ifname"`
|
||||
Routes []SRoute `json:"routes,omitempty"`
|
||||
|
||||
IsDefault bool `json:"is_default"`
|
||||
|
||||
NicType compute.TNicType `json:"nic_type,omitempty"`
|
||||
|
||||
LinkUp bool `json:"link_up,omitempty"`
|
||||
|
||||
@@ -262,6 +262,8 @@ func (self *SBaremetalGuestDriver) Attach2RandomNetwork(guest *models.SGuest, ct
|
||||
RequireDesignatedIP: false,
|
||||
UseDesignatedIP: reuseAddr,
|
||||
NicConfs: nicConfs,
|
||||
|
||||
IsDefault: netConfig.IsDefault,
|
||||
})
|
||||
}
|
||||
return nil, fmt.Errorf("No appropriate host virtual network...")
|
||||
|
||||
@@ -203,6 +203,8 @@ func (self *SVirtualizedGuestDriver) Attach2RandomNetwork(guest *models.SGuest,
|
||||
AllocDir: api.IPAllocationDefault,
|
||||
RequireDesignatedIP: netConfig.RequireDesignatedIP,
|
||||
NicConfs: nicConfs,
|
||||
|
||||
IsDefault: netConfig.IsDefault,
|
||||
})
|
||||
return gn, err
|
||||
}
|
||||
|
||||
@@ -66,6 +66,7 @@ import (
|
||||
"yunion.io/x/onecloud/pkg/mcclient/modules/scheduler"
|
||||
"yunion.io/x/onecloud/pkg/util/bitmap"
|
||||
"yunion.io/x/onecloud/pkg/util/logclient"
|
||||
"yunion.io/x/onecloud/pkg/util/netutils2"
|
||||
"yunion.io/x/onecloud/pkg/util/seclib2"
|
||||
)
|
||||
|
||||
@@ -2356,7 +2357,7 @@ func (self *SGuest) PerformChangeIpaddr(ctx context.Context, userCred mcclient.T
|
||||
conf.Mac = gn.MacAddr
|
||||
}
|
||||
|
||||
err = self.detachNetworks(ctx, userCred, []SGuestnetwork{*gn}, reserve, false)
|
||||
err = self.detachNetworks(ctx, userCred, []SGuestnetwork{*gn}, reserve)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -2446,14 +2447,23 @@ func (self *SGuest) GetIfNameByMac(ctx context.Context, userCred mcclient.TokenC
|
||||
return ifnameDevice, nil
|
||||
}
|
||||
|
||||
func (self *SGuest) PerformDetachnetwork(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject, input api.ServerDetachnetworkInput) (jsonutils.JSONObject, error) {
|
||||
if !utils.IsInStringArray(self.Status, []string{api.VM_READY, api.VM_RUNNING}) {
|
||||
func (self *SGuest) PerformDetachnetwork(
|
||||
ctx context.Context,
|
||||
userCred mcclient.TokenCredential,
|
||||
query jsonutils.JSONObject,
|
||||
input api.ServerDetachnetworkInput,
|
||||
) (jsonutils.JSONObject, error) {
|
||||
if !utils.IsInStringArray(self.Status, []string{api.VM_READY, api.VM_RUNNING}) && !input.IsForce() {
|
||||
return nil, httperrors.NewInvalidStatusError("Cannot detach network in status %s", self.Status)
|
||||
}
|
||||
|
||||
err := self.GetDriver().ValidateDetachNetwork(ctx, userCred, self)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
if !input.IsForce() {
|
||||
return nil, errors.Wrap(err, "ValidateDetachNetwork")
|
||||
} else {
|
||||
log.Errorf("ValidateDetachNetwork fail %s, ignore by force", err)
|
||||
}
|
||||
}
|
||||
|
||||
var gns []SGuestnetwork
|
||||
@@ -2488,17 +2498,66 @@ func (self *SGuest) PerformDetachnetwork(ctx context.Context, userCred mcclient.
|
||||
return nil, httperrors.NewMissingParameterError("net_id")
|
||||
}
|
||||
|
||||
if self.Status == api.VM_READY {
|
||||
return nil, self.detachNetworks(ctx, userCred, gns, input.Reserve, true)
|
||||
}
|
||||
err = self.detachNetworks(ctx, userCred, gns, input.Reserve, false)
|
||||
err = self.detachNetworks(ctx, userCred, gns, input.Reserve)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return nil, errors.Wrap(err, "detachNetworks")
|
||||
}
|
||||
return nil, self.StartSyncTask(ctx, userCred, false, "")
|
||||
|
||||
{
|
||||
// 修正缺省网关
|
||||
err := self.fixDefaultGateway(ctx, userCred)
|
||||
if err != nil {
|
||||
log.Errorf("fixDefaultGateway fail %s", err)
|
||||
}
|
||||
}
|
||||
|
||||
if !input.IsForce() && input.DisableSyncConfig != nil && !*input.DisableSyncConfig {
|
||||
if self.Status == api.VM_READY {
|
||||
err := self.StartGuestDeployTask(ctx, userCred, nil, "deploy", "")
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "StartGuestDeployTask")
|
||||
}
|
||||
} else {
|
||||
err := self.StartSyncTask(ctx, userCred, false, "")
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "StartSyncTask")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func (self *SGuest) PerformAttachnetwork(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject, input *api.AttachNetworkInput) (*api.SGuest, error) {
|
||||
func (guest *SGuest) fixDefaultGateway(ctx context.Context, userCred mcclient.TokenCredential) error {
|
||||
defaultGwCnt := 0
|
||||
nicList := netutils2.SNicInfoList{}
|
||||
nics, _ := guest.GetNetworks("")
|
||||
for i := range nics {
|
||||
net := nics[i].GetNetwork()
|
||||
nicList = nicList.Add(nics[i].IpAddr, nics[i].MacAddr, net.GuestGateway)
|
||||
if nics[i].IsDefault {
|
||||
defaultGwCnt++
|
||||
}
|
||||
}
|
||||
if defaultGwCnt != 1 {
|
||||
gwMac, _ := nicList.FindDefaultNicMac()
|
||||
if gwMac != "" {
|
||||
err := guest.setDefaultGateway(ctx, userCred, gwMac)
|
||||
if err != nil {
|
||||
log.Errorf("setDefaultGateway fail %s", err)
|
||||
return errors.Wrap(err, "setDefaultGateway")
|
||||
}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (self *SGuest) PerformAttachnetwork(
|
||||
ctx context.Context,
|
||||
userCred mcclient.TokenCredential,
|
||||
query jsonutils.JSONObject,
|
||||
input *api.AttachNetworkInput,
|
||||
) (*api.SGuest, error) {
|
||||
if !utils.IsInStringArray(self.Status, []string{api.VM_READY, api.VM_RUNNING}) {
|
||||
return nil, httperrors.NewBadRequestError("Cannot attach network in status %s", self.Status)
|
||||
}
|
||||
@@ -2506,7 +2565,7 @@ func (self *SGuest) PerformAttachnetwork(ctx context.Context, userCred mcclient.
|
||||
if count == 0 {
|
||||
return nil, httperrors.NewMissingParameterError("nets")
|
||||
}
|
||||
var inicCnt, enicCnt, isolatedDevCount int
|
||||
var inicCnt, enicCnt, isolatedDevCount, defaultGwCnt int
|
||||
for i := 0; i < count; i++ {
|
||||
err := isValidNetworkInfo(ctx, userCred, input.Nets[i], "")
|
||||
if err != nil {
|
||||
@@ -2535,6 +2594,12 @@ func (self *SGuest) PerformAttachnetwork(ctx context.Context, userCred mcclient.
|
||||
input.Nets[i].Driver = api.NETWORK_DRIVER_VFIO
|
||||
isolatedDevCount += 1
|
||||
}
|
||||
if input.Nets[i].IsDefault {
|
||||
defaultGwCnt++
|
||||
}
|
||||
}
|
||||
if defaultGwCnt > 1 {
|
||||
return nil, errors.Wrapf(httperrors.ErrInputParameter, "more than 1 nic(%d) assigned as default gateway", defaultGwCnt)
|
||||
}
|
||||
|
||||
pendingUsage := &SRegionQuota{
|
||||
@@ -2558,12 +2623,16 @@ func (self *SGuest) PerformAttachnetwork(ctx context.Context, userCred mcclient.
|
||||
if err != nil {
|
||||
return nil, httperrors.NewOutOfQuotaError("%v", err)
|
||||
}
|
||||
defer quotas.CancelPendingUsage(ctx, userCred, pendingUsage, pendingUsage, false)
|
||||
err = quotas.CheckSetPendingQuota(ctx, userCred, pendingUsageHost)
|
||||
if err != nil {
|
||||
return nil, httperrors.NewOutOfQuotaError("%v", err)
|
||||
}
|
||||
defer quotas.CancelPendingUsage(ctx, userCred, pendingUsageHost, pendingUsageHost, false)
|
||||
host, _ := self.GetHost()
|
||||
defer host.ClearSchedDescCache()
|
||||
|
||||
var defaultGwGn *SGuestnetwork
|
||||
for i := 0; i < count; i++ {
|
||||
gns, err := self.attach2NetworkDesc(ctx, userCred, host, input.Nets[i], pendingUsage, nil)
|
||||
logclient.AddSimpleActionLog(self, logclient.ACT_ATTACH_NETWORK, input.Nets[i], userCred, err == nil)
|
||||
@@ -2571,6 +2640,12 @@ func (self *SGuest) PerformAttachnetwork(ctx context.Context, userCred mcclient.
|
||||
quotas.CancelPendingUsage(ctx, userCred, pendingUsage, pendingUsage, false)
|
||||
return nil, httperrors.NewBadRequestError("%v", err)
|
||||
}
|
||||
for gnIdx := range gns {
|
||||
if gns[gnIdx].IsDefault {
|
||||
defaultGwGn = &gns[gnIdx]
|
||||
}
|
||||
}
|
||||
|
||||
if input.Nets[i].SriovDevice != nil {
|
||||
err = self.allocSriovNicDevice(ctx, userCred, host, &gns[0], input.Nets[i], pendingUsageHost)
|
||||
if err != nil {
|
||||
@@ -2580,16 +2655,34 @@ func (self *SGuest) PerformAttachnetwork(ctx context.Context, userCred mcclient.
|
||||
}
|
||||
}
|
||||
|
||||
if self.Status == api.VM_READY {
|
||||
err = self.StartGuestDeployTask(ctx, userCred, nil, "deploy", "")
|
||||
// adjust default gateway
|
||||
if defaultGwGn != nil {
|
||||
err := self.setDefaultGateway(ctx, userCred, defaultGwGn.MacAddr)
|
||||
if err != nil {
|
||||
log.Errorf("setDefaultGateway fail %s", err)
|
||||
}
|
||||
} else {
|
||||
err = self.StartSyncTask(ctx, userCred, false, "")
|
||||
err := self.fixDefaultGateway(ctx, userCred)
|
||||
if err != nil {
|
||||
log.Errorf("fixDefaultGateway fail %s", err)
|
||||
}
|
||||
}
|
||||
if err != nil {
|
||||
quotas.CancelPendingUsage(ctx, userCred, pendingUsage, pendingUsage, false)
|
||||
quotas.CancelPendingUsage(ctx, userCred, pendingUsageHost, pendingUsageHost, false)
|
||||
|
||||
if input.DisableSyncConfig != nil && !*input.DisableSyncConfig {
|
||||
if self.Status == api.VM_READY {
|
||||
err := self.StartGuestDeployTask(ctx, userCred, nil, "deploy", "")
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "StartGuestDeployTask")
|
||||
}
|
||||
} else {
|
||||
err := self.StartSyncTask(ctx, userCred, false, "")
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "StartSyncTask")
|
||||
}
|
||||
}
|
||||
}
|
||||
return nil, err
|
||||
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func (self *SGuest) PerformChangeBandwidth(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject, data jsonutils.JSONObject) (jsonutils.JSONObject, error) {
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
// Copyright 2019 Yunion
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package models
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"yunion.io/x/pkg/errors"
|
||||
|
||||
"yunion.io/x/onecloud/pkg/cloudcommon/db"
|
||||
"yunion.io/x/onecloud/pkg/cloudcommon/db/lockman"
|
||||
"yunion.io/x/onecloud/pkg/mcclient"
|
||||
"yunion.io/x/onecloud/pkg/util/logclient"
|
||||
)
|
||||
|
||||
func (guest *SGuest) setDefaultGateway(ctx context.Context, userCred mcclient.TokenCredential, macAddr string) error {
|
||||
lockman.LockObject(ctx, guest)
|
||||
defer lockman.ReleaseObject(ctx, guest)
|
||||
|
||||
gns, err := guest.GetNetworks("")
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "GetNetworks")
|
||||
}
|
||||
var defaultGw *SGuestnetwork
|
||||
for i := range gns {
|
||||
gn := gns[i]
|
||||
if (gn.IsDefault && gn.MacAddr != macAddr) || (!gn.IsDefault && gn.MacAddr == macAddr) {
|
||||
_, err := db.Update(&gn, func() error {
|
||||
gn.IsDefault = (gn.MacAddr == macAddr)
|
||||
return nil
|
||||
})
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "set default gateway")
|
||||
}
|
||||
if gn.MacAddr == macAddr {
|
||||
defaultGw = &gn
|
||||
}
|
||||
}
|
||||
}
|
||||
if defaultGw != nil {
|
||||
notes := defaultGw.GetShortDesc(ctx)
|
||||
db.OpsLog.LogEvent(guest, db.ACT_UPDATE, notes, userCred)
|
||||
logclient.AddActionLogWithContext(ctx, guest, logclient.ACT_UPDATE, notes, userCred, true)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -133,8 +133,10 @@ func (manager *SGuestManager) FetchCustomizeColumns(
|
||||
if len(fields) == 0 || fields.Contains("subips") {
|
||||
subips := make([]string, 0)
|
||||
for _, nic := range nics {
|
||||
ips := strings.Split(nic.SubIps, ",")
|
||||
subips = append(subips, ips...)
|
||||
if len(nic.SubIps) > 0 {
|
||||
ips := strings.Split(nic.SubIps, ",")
|
||||
subips = append(subips, ips...)
|
||||
}
|
||||
}
|
||||
rows[i].SubIPs = subips
|
||||
}
|
||||
|
||||
@@ -110,6 +110,9 @@ type SGuestnetwork struct {
|
||||
|
||||
// 网卡关联的Eip实例
|
||||
EipId string `width:"36" charset:"ascii" nullable:"true" list:"user"`
|
||||
|
||||
// 是否为缺省路由
|
||||
IsDefault bool `default:"false" list:"user"`
|
||||
}
|
||||
|
||||
func (gn SGuestnetwork) GetIP() string {
|
||||
@@ -240,6 +243,9 @@ type newGuestNetworkArgs struct {
|
||||
requireDesignatedIP bool
|
||||
useDesignatedIP bool
|
||||
|
||||
// 是否为缺省路由
|
||||
isDefault bool
|
||||
|
||||
ifname string
|
||||
macAddr string
|
||||
bwLimit int
|
||||
@@ -276,6 +282,7 @@ func (manager *SGuestnetworkManager) newGuestNetwork(
|
||||
reUseAddr = args.useDesignatedIP
|
||||
ifname = args.ifname
|
||||
teamWithMac = args.teamWithMac
|
||||
isDefault = args.isDefault
|
||||
)
|
||||
|
||||
gn.GuestId = guest.Id
|
||||
@@ -365,6 +372,11 @@ func (manager *SGuestnetworkManager) newGuestNetwork(
|
||||
}
|
||||
gn.Ifname = ifname
|
||||
gn.TeamWith = teamWithMac
|
||||
|
||||
if isDefault && len(gn.IpAddr) > 0 && len(network.GuestGateway) > 0 {
|
||||
gn.IsDefault = isDefault
|
||||
}
|
||||
|
||||
err = manager.TableSpec().Insert(ctx, &gn)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -573,6 +585,8 @@ func (gn *SGuestnetwork) getJsonDesc() *api.GuestnetworkJsonDesc {
|
||||
NetId: gn.NetworkId,
|
||||
Mac: gn.MacAddr,
|
||||
Virtual: gn.Virtual,
|
||||
|
||||
IsDefault: gn.IsDefault,
|
||||
},
|
||||
}
|
||||
|
||||
@@ -695,6 +709,15 @@ func (gn *SGuestnetwork) ValidateUpdateData(
|
||||
return input, httperrors.NewDuplicateResourceError("NIC Index %d has been occupied", index)
|
||||
}
|
||||
}
|
||||
if input.IsDefault != nil && *input.IsDefault {
|
||||
net := gn.GetNetwork()
|
||||
if len(net.GuestGateway) == 0 {
|
||||
return input, errors.Wrap(httperrors.ErrInvalidStatus, "network of default gateway has no gateway")
|
||||
}
|
||||
if len(gn.IpAddr) == 0 {
|
||||
return input, errors.Wrap(httperrors.ErrInvalidStatus, "nic of default gateway has no ip")
|
||||
}
|
||||
}
|
||||
var err error
|
||||
input.GuestJointBaseUpdateInput, err = gn.SGuestJointsBase.ValidateUpdateData(ctx, userCred, query, input.GuestJointBaseUpdateInput)
|
||||
if err != nil {
|
||||
@@ -703,6 +726,31 @@ func (gn *SGuestnetwork) ValidateUpdateData(
|
||||
return input, nil
|
||||
}
|
||||
|
||||
func (gn *SGuestnetwork) PostUpdate(ctx context.Context, userCred mcclient.TokenCredential, query, data jsonutils.JSONObject) {
|
||||
gn.SGuestJointsBase.PostUpdate(ctx, userCred, query, data)
|
||||
input := api.GuestnetworkUpdateInput{}
|
||||
err := data.Unmarshal(&input)
|
||||
if err != nil {
|
||||
log.Errorf("GuestnetworkUpdateInput unmarshal fail %s", err)
|
||||
return
|
||||
}
|
||||
if input.IsDefault != nil && *input.IsDefault {
|
||||
// make this nic as default, unset others
|
||||
guest := gn.GetGuest()
|
||||
err := guest.setDefaultGateway(ctx, userCred, gn.MacAddr)
|
||||
if err != nil {
|
||||
log.Errorf("fail to setDefaultGateway: %s", err)
|
||||
}
|
||||
} else {
|
||||
// try fix default gateway
|
||||
guest := gn.GetGuest()
|
||||
err := guest.fixDefaultGateway(ctx, userCred)
|
||||
if err != nil {
|
||||
log.Errorf("fail to fixDefaultGateway %s", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (manager *SGuestnetworkManager) DeleteGuestNics(ctx context.Context, userCred mcclient.TokenCredential, gns []SGuestnetwork, reserve bool) error {
|
||||
for i := range gns {
|
||||
gn := gns[i]
|
||||
|
||||
@@ -1801,6 +1801,8 @@ func (manager *SGuestManager) validateCreateData(
|
||||
input.Networks = append(input.Networks, &api.NetworkConfig{Exit: false})
|
||||
}
|
||||
netArray := input.Networks
|
||||
defaultGwCnt := 0
|
||||
firstExit := -1
|
||||
for idx := 0; idx < len(netArray); idx += 1 {
|
||||
netConfig, err := parseNetworkInfo(ctx, userCred, netArray[idx])
|
||||
if err != nil {
|
||||
@@ -1831,8 +1833,26 @@ func (manager *SGuestManager) validateCreateData(
|
||||
|
||||
netConfig.Project = ownerId.GetProjectId()
|
||||
netConfig.Domain = ownerId.GetProjectDomainId()
|
||||
if netConfig.IsDefault {
|
||||
defaultGwCnt++
|
||||
}
|
||||
if firstExit < 0 && netConfig.Exit {
|
||||
firstExit = idx
|
||||
}
|
||||
input.Networks[idx] = netConfig
|
||||
}
|
||||
// check default gateway
|
||||
if defaultGwCnt == 0 {
|
||||
defIdx := 0
|
||||
if firstExit >= 0 {
|
||||
// there is a exit network, make it the default
|
||||
defIdx = firstExit
|
||||
}
|
||||
// make the first nic as default
|
||||
input.Networks[defIdx].IsDefault = true
|
||||
} else if defaultGwCnt > 1 {
|
||||
return nil, errors.Wrapf(httperrors.ErrInputParameter, "more than 1 nic(%d) assigned as default gateway", defaultGwCnt)
|
||||
}
|
||||
|
||||
isoDevArray := input.IsolatedDevices
|
||||
for idx := 0; idx < len(isoDevArray); idx += 1 { // .Contains(fmt.Sprintf("isolated_device.%d", idx)); idx += 1 {
|
||||
@@ -3248,7 +3268,7 @@ func (manager *SGuestManager) TotalCount(
|
||||
return usageTotalGuestResouceCount(scope, ownerId, rangeObjs, status, hypervisors, includeSystem, pendingDelete, hostTypes, resourceTypes, providers, brands, cloudEnv, since, policyResult)
|
||||
}
|
||||
|
||||
func (self *SGuest) detachNetworks(ctx context.Context, userCred mcclient.TokenCredential, gns []SGuestnetwork, reserve bool, deploy bool) error {
|
||||
func (self *SGuest) detachNetworks(ctx context.Context, userCred mcclient.TokenCredential, gns []SGuestnetwork, reserve bool) error {
|
||||
err := GuestnetworkManager.DeleteGuestNics(ctx, userCred, gns, reserve)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -3257,9 +3277,6 @@ func (self *SGuest) detachNetworks(ctx context.Context, userCred mcclient.TokenC
|
||||
if host != nil {
|
||||
host.ClearSchedDescCache() // ignore error
|
||||
}
|
||||
if deploy {
|
||||
self.StartGuestDeployTask(ctx, userCred, nil, "deploy", "")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -3336,6 +3353,8 @@ type Attach2NetworkArgs struct {
|
||||
|
||||
Virtual bool
|
||||
|
||||
IsDefault bool
|
||||
|
||||
PendingUsage quotas.IQuota
|
||||
}
|
||||
|
||||
@@ -3361,6 +3380,8 @@ func (args *Attach2NetworkArgs) onceArgs(i int) attach2NetworkOnceArgs {
|
||||
|
||||
virtual: args.Virtual,
|
||||
|
||||
isDefault: args.IsDefault,
|
||||
|
||||
pendingUsage: args.PendingUsage,
|
||||
}
|
||||
if i > 0 {
|
||||
@@ -3373,6 +3394,7 @@ func (args *Attach2NetworkArgs) onceArgs(i int) attach2NetworkOnceArgs {
|
||||
r.nicConf = args.NicConfs[i]
|
||||
r.nicDriver = ""
|
||||
r.numQueues = 1
|
||||
r.isDefault = false
|
||||
}
|
||||
return r
|
||||
}
|
||||
@@ -3396,6 +3418,8 @@ type attach2NetworkOnceArgs struct {
|
||||
|
||||
virtual bool
|
||||
|
||||
isDefault bool
|
||||
|
||||
pendingUsage quotas.IQuota
|
||||
}
|
||||
|
||||
@@ -3469,6 +3493,8 @@ func (self *SGuest) attach2NetworkOnce(
|
||||
txTrafficLimit: args.txTrafficLimit,
|
||||
|
||||
virtual: args.virtual,
|
||||
|
||||
isDefault: args.isDefault,
|
||||
}
|
||||
lockman.LockClass(ctx, QuotaManager, self.ProjectId)
|
||||
defer lockman.ReleaseClass(ctx, QuotaManager, self.ProjectId)
|
||||
@@ -3592,7 +3618,7 @@ func (self *SGuest) SyncVMNics(
|
||||
log.Debugf("SyncVMNics: removed: %d common: %d add: %d", len(removed), len(commondb), len(added))
|
||||
|
||||
for i := 0; i < len(removed); i += 1 {
|
||||
err = self.detachNetworks(ctx, userCred, []SGuestnetwork{removed[i]}, false, false)
|
||||
err = self.detachNetworks(ctx, userCred, []SGuestnetwork{removed[i]}, false)
|
||||
if err != nil {
|
||||
result.DeleteError(err)
|
||||
continue
|
||||
@@ -4224,6 +4250,8 @@ func (self *SGuest) attach2NamedNetworkDesc(ctx context.Context, userCred mcclie
|
||||
RequireDesignatedIP: netConfig.RequireDesignatedIP,
|
||||
UseDesignatedIP: reuseAddr,
|
||||
NicConfs: nicConfs,
|
||||
|
||||
IsDefault: netConfig.IsDefault,
|
||||
})
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "Attach2Network fail")
|
||||
|
||||
@@ -2907,7 +2907,11 @@ func (a SNetworkUsedAddressList) Less(i, j int) bool {
|
||||
return ipI < ipJ
|
||||
}
|
||||
|
||||
func (network *SNetwork) GetDetailsAddresses(ctx context.Context, userCred mcclient.TokenCredential, input api.GetNetworkAddressesInput) (api.GetNetworkAddressesOutput, error) {
|
||||
func (network *SNetwork) GetDetailsAddresses(
|
||||
ctx context.Context,
|
||||
userCred mcclient.TokenCredential,
|
||||
input api.GetNetworkAddressesInput,
|
||||
) (api.GetNetworkAddressesOutput, error) {
|
||||
output := api.GetNetworkAddressesOutput{}
|
||||
|
||||
allowScope, _ := policy.PolicyManager.AllowScope(userCred, api.SERVICE_TYPE, network.KeywordPlural(), policy.PolicyActionGet, "addresses")
|
||||
@@ -2929,6 +2933,28 @@ func (network *SNetwork) GetDetailsAddresses(ctx context.Context, userCred mccli
|
||||
return output, nil
|
||||
}
|
||||
|
||||
func (network *SNetwork) GetDetailsAvailableAddresses(
|
||||
ctx context.Context,
|
||||
userCred mcclient.TokenCredential,
|
||||
input api.GetNetworkAvailableAddressesInput,
|
||||
) (api.GetNetworkAvailableAddressesOutput, error) {
|
||||
var availables []string
|
||||
addrTable := network.GetUsedAddresses()
|
||||
recentUsedAddrTable := GuestnetworkManager.getRecentlyReleasedIPAddresses(network.Id, network.getAllocTimoutDuration())
|
||||
addrRange := network.getIPRange()
|
||||
for addr := addrRange.StartIp(); addr <= addrRange.EndIp(); addr = addr.StepUp() {
|
||||
addrStr := addr.String()
|
||||
if _, ok := addrTable[addrStr]; !ok {
|
||||
if _, ok := recentUsedAddrTable[addrStr]; !ok {
|
||||
availables = append(availables, addrStr)
|
||||
}
|
||||
}
|
||||
}
|
||||
return api.GetNetworkAvailableAddressesOutput{
|
||||
Addresses: availables,
|
||||
}, nil
|
||||
}
|
||||
|
||||
// 同步接入云IP子网状态
|
||||
// 本地IDC不支持此操作
|
||||
func (net *SNetwork) PerformSyncstatus(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject, input *api.NetworkSyncInput) (jsonutils.JSONObject, error) {
|
||||
|
||||
@@ -69,7 +69,9 @@ func (s *SExsiAgentService) StartService() {
|
||||
log.Infof("auth complete")
|
||||
})
|
||||
|
||||
fsdriver.Init(nil, "")
|
||||
options_common.StartOptionManager(&options.Options.CommonOptions, options.Options.ConfigSyncPeriodSeconds, "", "", options_common.OnCommonOptionsChange)
|
||||
|
||||
fsdriver.Init("")
|
||||
deployclient.Init(options.Options.DeployServerSocketPath)
|
||||
|
||||
hostutils.InitWorkerManagerWithCount(options.Options.HostDelayTaskWorkerCount)
|
||||
|
||||
@@ -52,8 +52,9 @@ var (
|
||||
|
||||
RUN_ON_HOST_ROOT_PATH = "/opt/cloud/host-deployer"
|
||||
|
||||
DEPLOY_ISO = "/opt/cloud/host-deployer/host_deployer_v1.iso"
|
||||
DEPLOYER_BIN = "/opt/yunion/bin/host-deployer --common-config-file /opt/yunion/common.conf --config /opt/yunion/host.conf"
|
||||
DEPLOY_ISO = "/opt/cloud/host-deployer/host_deployer_v1.iso"
|
||||
// DEPLOYER_BIN = "/opt/yunion/bin/host-deployer --common-config-file /opt/yunion/common.conf --config /opt/yunion/host.conf"
|
||||
DEPLOYER_BIN = "/opt/yunion/bin/host-deployer --config /opt/yunion/host.conf"
|
||||
YUNIONOS_PASSWD = "mosbaremetal"
|
||||
)
|
||||
|
||||
|
||||
+10
-10
@@ -101,16 +101,16 @@ func DoDeployGuestFs(rootfs fsdriver.IRootFsDriver, guestDesc *deployapi.GuestDe
|
||||
}
|
||||
|
||||
if deployInfo.IsInit {
|
||||
if err = rootfs.CleanNetworkScripts(partition); err != nil {
|
||||
if err := rootfs.CleanNetworkScripts(partition); err != nil {
|
||||
return nil, errors.Wrap(err, "Clean network scripts")
|
||||
}
|
||||
if len(deployInfo.Deploys) > 0 {
|
||||
if err = rootfs.DeployFiles(deployInfo.Deploys); err != nil {
|
||||
if err := rootfs.DeployFiles(deployInfo.Deploys); err != nil {
|
||||
return nil, errors.Wrap(err, "DeployFiles")
|
||||
}
|
||||
}
|
||||
if len(deployInfo.UserData) > 0 {
|
||||
if err = rootfs.DeployUserData(deployInfo.UserData); err != nil {
|
||||
if err := rootfs.DeployUserData(deployInfo.UserData); err != nil {
|
||||
return nil, errors.Wrap(err, "DeployUserData")
|
||||
}
|
||||
}
|
||||
@@ -124,32 +124,32 @@ func DoDeployGuestFs(rootfs fsdriver.IRootFsDriver, guestDesc *deployapi.GuestDe
|
||||
}
|
||||
}
|
||||
|
||||
if err = rootfs.DeployHostname(partition, hn, domain); err != nil {
|
||||
if err := rootfs.DeployHostname(partition, hn, domain); err != nil {
|
||||
return nil, errors.Wrap(err, "DeployHostname")
|
||||
}
|
||||
if err = rootfs.DeployHosts(partition, hn, domain, ips); err != nil {
|
||||
if err := rootfs.DeployHosts(partition, hn, domain, ips); err != nil {
|
||||
return nil, errors.Wrap(err, "DeployHosts")
|
||||
}
|
||||
|
||||
if guestDesc.Hypervisor == comapi.HYPERVISOR_KVM {
|
||||
if err = rootfs.DeployQgaBlackList(partition); err != nil {
|
||||
if err := rootfs.DeployQgaBlackList(partition); err != nil {
|
||||
return nil, fmt.Errorf("DeployQgaBlackList: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
if err = rootfs.DeployNetworkingScripts(partition, nics); err != nil {
|
||||
if err := rootfs.DeployNetworkingScripts(partition, nics); err != nil {
|
||||
return nil, errors.Wrap(err, "DeployNetworkingScripts")
|
||||
}
|
||||
if len(nicsStandby) > 0 {
|
||||
if err = rootfs.DeployStandbyNetworkingScripts(partition, nics, nicsStandby); err != nil {
|
||||
if err := rootfs.DeployStandbyNetworkingScripts(partition, nics, nicsStandby); err != nil {
|
||||
return nil, errors.Wrap(err, "DeployStandbyNetworkingScripts")
|
||||
}
|
||||
}
|
||||
if err = rootfs.DeployUdevSubsystemScripts(partition); err != nil {
|
||||
if err := rootfs.DeployUdevSubsystemScripts(partition); err != nil {
|
||||
return nil, errors.Wrap(err, "DeployUdevSubsystemScripts")
|
||||
}
|
||||
if deployInfo.IsInit {
|
||||
if err = rootfs.DeployFstabScripts(partition, guestDesc.Disks); err != nil {
|
||||
if err := rootfs.DeployFstabScripts(partition, guestDesc.Disks); err != nil {
|
||||
return nil, errors.Wrap(err, "DeployFstabScripts")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ import (
|
||||
type newRootFsDriverFunc func(part IDiskPartition) IRootFsDriver
|
||||
|
||||
var (
|
||||
privatePrefixes []string
|
||||
// privatePrefixes []string
|
||||
rootfsDrivers = make([]newRootFsDriverFunc, 0)
|
||||
hostCpuArch string
|
||||
cloudrootDirectory string
|
||||
@@ -35,12 +35,7 @@ func GetRootfsDrivers() []newRootFsDriverFunc {
|
||||
return rootfsDrivers
|
||||
}
|
||||
|
||||
func Init(initPrivatePrefixes []string, cloudrootDir string) error {
|
||||
if len(initPrivatePrefixes) > 0 {
|
||||
privatePrefixes = make([]string, len(initPrivatePrefixes))
|
||||
copy(privatePrefixes, initPrivatePrefixes)
|
||||
}
|
||||
|
||||
func Init(cloudrootDir string) error {
|
||||
linuxFsDrivers := []newRootFsDriverFunc{
|
||||
NewFangdeRootFs, NewUnionOSRootFs,
|
||||
NewAnolisRootFs, NewRockyRootFs,
|
||||
|
||||
@@ -30,7 +30,6 @@ import (
|
||||
"yunion.io/x/jsonutils"
|
||||
"yunion.io/x/log"
|
||||
"yunion.io/x/pkg/errors"
|
||||
"yunion.io/x/pkg/util/netutils"
|
||||
"yunion.io/x/pkg/utils"
|
||||
|
||||
"yunion.io/x/onecloud/pkg/apis"
|
||||
@@ -916,10 +915,7 @@ func (d *sDebianLikeRootFs) DeployNetworkingScripts(rootFs IDiskPartition, nics
|
||||
}
|
||||
}
|
||||
|
||||
mainNic, err := getMainNic(allNics)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
mainNic := getMainNic(allNics)
|
||||
var mainIp string
|
||||
if mainNic != nil {
|
||||
mainIp = mainNic.Ip
|
||||
@@ -952,7 +948,7 @@ func (d *sDebianLikeRootFs) DeployNetworkingScripts(rootFs IDiskPartition, nics
|
||||
cmds.WriteString(fmt.Sprintf(" mtu %d\n", nicDesc.Mtu))
|
||||
}
|
||||
var routes = make([][]string, 0)
|
||||
netutils2.AddNicRoutes(&routes, nicDesc, mainIp, len(nics), privatePrefixes)
|
||||
routes = netutils2.AddNicRoutes(routes, nicDesc, mainIp, len(nics))
|
||||
for _, r := range routes {
|
||||
cmds.WriteString(fmt.Sprintf(" up route add -net %s gw %s || true\n", r[0], r[1]))
|
||||
cmds.WriteString(fmt.Sprintf(" down route del -net %s gw %s || true\n", r[0], r[1]))
|
||||
@@ -1272,25 +1268,13 @@ func (r *sRedhatLikeRootFs) Centos5DeployNetworkingScripts(rootFs IDiskPartition
|
||||
return nil
|
||||
}
|
||||
|
||||
func getMainNic(nics []*types.SServerNic) (*types.SServerNic, error) {
|
||||
var mainIp netutils.IPV4Addr
|
||||
var mainNic *types.SServerNic
|
||||
func getMainNic(nics []*types.SServerNic) *types.SServerNic {
|
||||
for i := range nics {
|
||||
if len(nics[i].Gateway) > 0 {
|
||||
ipInt, err := netutils.NewIPV4Addr(nics[i].Ip)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if mainIp == 0 {
|
||||
mainIp = ipInt
|
||||
mainNic = nics[i]
|
||||
} else if !netutils.IsPrivate(ipInt) && netutils.IsPrivate(mainIp) {
|
||||
mainIp = ipInt
|
||||
mainNic = nics[i]
|
||||
}
|
||||
if nics[i].IsDefault {
|
||||
return nics[i]
|
||||
}
|
||||
}
|
||||
return mainNic, nil
|
||||
return nil
|
||||
}
|
||||
|
||||
func (r *sRedhatLikeRootFs) enableBondingModule(rootFs IDiskPartition, bondNics []*types.SServerNic) error {
|
||||
@@ -1311,8 +1295,14 @@ func (r *sRedhatLikeRootFs) isNetworkManagerEnabled(rootFs IDiskPartition) bool
|
||||
}
|
||||
|
||||
func (r *sRedhatLikeRootFs) deployNetworkingScripts(rootFs IDiskPartition, nics []*types.SServerNic, relInfo *deployapi.ReleaseInfo) error {
|
||||
if err := r.sLinuxRootFs.DeployNetworkingScripts(rootFs, nics); err != nil {
|
||||
return err
|
||||
// remove all ifcfg-*
|
||||
const scriptPath = "/etc/sysconfig/network-scripts"
|
||||
files := rootFs.ListDir(scriptPath, false)
|
||||
for _, f := range files {
|
||||
if strings.HasPrefix(f, "ifcfg-") && f != "ifcfg-lo" {
|
||||
log.Infof("remove %s in %s", f, scriptPath)
|
||||
rootFs.Remove(filepath.Join(scriptPath, f), false)
|
||||
}
|
||||
}
|
||||
|
||||
ver := strings.Split(relInfo.Version, ".")
|
||||
@@ -1323,20 +1313,18 @@ func (r *sRedhatLikeRootFs) deployNetworkingScripts(rootFs IDiskPartition, nics
|
||||
err = r.sLinuxRootFs.DeployNetworkingScripts(rootFs, nics)
|
||||
}
|
||||
if err != nil {
|
||||
return err
|
||||
return errors.Wrap(err, "DeployNetworkingScripts")
|
||||
}
|
||||
// ToServerNics(nics)
|
||||
allNics, bondNics := convertNicConfigs(nics)
|
||||
if len(bondNics) > 0 {
|
||||
err = r.enableBondingModule(rootFs, bondNics)
|
||||
if err != nil {
|
||||
return err
|
||||
return errors.Wrap(err, "enableBondingModule")
|
||||
}
|
||||
}
|
||||
mainNic, err := getMainNic(allNics)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
mainNic := getMainNic(allNics)
|
||||
var mainIp string
|
||||
if mainNic != nil {
|
||||
mainIp = mainNic.Ip
|
||||
@@ -1398,7 +1386,7 @@ func (r *sRedhatLikeRootFs) deployNetworkingScripts(rootFs IDiskPartition, nics
|
||||
cmds.WriteString("\n")
|
||||
}
|
||||
var routes = make([][]string, 0)
|
||||
netutils2.AddNicRoutes(&routes, nicDesc, mainIp, len(nics), privatePrefixes)
|
||||
routes = netutils2.AddNicRoutes(routes, nicDesc, mainIp, len(nics))
|
||||
var rtbl strings.Builder
|
||||
for _, r := range routes {
|
||||
rtbl.WriteString(r[0])
|
||||
@@ -1410,7 +1398,7 @@ func (r *sRedhatLikeRootFs) deployNetworkingScripts(rootFs IDiskPartition, nics
|
||||
}
|
||||
rtblStr := rtbl.String()
|
||||
if len(rtblStr) > 0 {
|
||||
var fn = fmt.Sprintf("/etc/sysconfig/network-scripts/route-%s", nicDesc.Name)
|
||||
var fn = fmt.Sprintf("%s/route-%s", scriptPath, nicDesc.Name)
|
||||
if err := rootFs.FilePutContents(fn, rtblStr, false, false); err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -1428,7 +1416,7 @@ func (r *sRedhatLikeRootFs) deployNetworkingScripts(rootFs IDiskPartition, nics
|
||||
} else {
|
||||
cmds.WriteString("BOOTPROTO=dhcp\n")
|
||||
}
|
||||
var fn = fmt.Sprintf("/etc/sysconfig/network-scripts/ifcfg-%s", nicDesc.Name)
|
||||
var fn = fmt.Sprintf("%s/ifcfg-%s", scriptPath, nicDesc.Name)
|
||||
log.Debugf("%s: %s", fn, cmds.String())
|
||||
if err := rootFs.FilePutContents(fn, cmds.String(), false, false); err != nil {
|
||||
return err
|
||||
@@ -1536,7 +1524,7 @@ func (c *SCentosRootFs) GetReleaseInfo(rootFs IDiskPartition) *deployapi.Release
|
||||
func (c *SCentosRootFs) DeployNetworkingScripts(rootFs IDiskPartition, nics []*types.SServerNic) error {
|
||||
relInfo := c.GetReleaseInfo(rootFs)
|
||||
if err := c.sRedhatLikeRootFs.deployNetworkingScripts(rootFs, nics, relInfo); err != nil {
|
||||
return err
|
||||
return errors.Wrap(err, "sRedhatLikeRootFs.deployNetworkingScripts")
|
||||
}
|
||||
var udevPath = "/etc/udev/rules.d/"
|
||||
var files = []string{"60-net.rules", "75-persistent-net-generator.rules"}
|
||||
@@ -1544,7 +1532,7 @@ func (c *SCentosRootFs) DeployNetworkingScripts(rootFs IDiskPartition, nics []*t
|
||||
sPath := path.Join(udevPath, f)
|
||||
if !rootFs.Exists(sPath, false) {
|
||||
if err := rootFs.FilePutContents(sPath, "", false, false); err != nil {
|
||||
return err
|
||||
return errors.Wrapf(err, "save %s", sPath)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,6 +72,7 @@ func ToServerNics(nics []*deployapi.Nic) []*types.SServerNic {
|
||||
LinkUp: nics[i].LinkUp,
|
||||
Mtu: int16(nics[i].Mtu),
|
||||
TeamWith: nics[i].TeamWith,
|
||||
IsDefault: nics[i].IsDefault,
|
||||
}
|
||||
}
|
||||
return ret
|
||||
|
||||
@@ -100,10 +100,7 @@ func (r *sSuseLikeRootFs) deployNetworkingScripts(rootFs IDiskPartition, nics []
|
||||
}
|
||||
|
||||
var dnsSrv []string
|
||||
mainNic, err := getMainNic(allNics)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
mainNic := getMainNic(allNics)
|
||||
var mainIp string
|
||||
if mainNic != nil {
|
||||
mainIp = mainNic.Ip
|
||||
@@ -146,7 +143,7 @@ func (r *sSuseLikeRootFs) deployNetworkingScripts(rootFs IDiskPartition, nics []
|
||||
cmds.WriteString("\n")
|
||||
|
||||
var routes = make([][]string, 0)
|
||||
netutils2.AddNicRoutes(&routes, nicDesc, mainIp, len(nics), privatePrefixes)
|
||||
routes = netutils2.AddNicRoutes(routes, nicDesc, mainIp, len(nics))
|
||||
if len(nicDesc.Gateway) > 0 && nicDesc.Ip == mainIp {
|
||||
routes = append(routes, []string{
|
||||
"0.0.0.0/0",
|
||||
|
||||
@@ -322,7 +322,7 @@ func (w *SWindowsRootFs) DeployNetworkingScripts(rootfs IDiskPartition, nics []*
|
||||
}
|
||||
lines = append(lines, cfg)
|
||||
routes := [][]string{}
|
||||
netutils2.AddNicRoutes(&routes, snic, mainIp, len(nics), privatePrefixes)
|
||||
routes = netutils2.AddNicRoutes(routes, snic, mainIp, len(nics))
|
||||
for _, r := range routes {
|
||||
lines = append(lines, fmt.Sprintf(` netsh interface ip add route %s "%%%%b" %s`, r[0], r[1]))
|
||||
}
|
||||
|
||||
@@ -1628,11 +1628,30 @@ func (s *SKVMGuestInstance) CheckBlockOrRunning(jobs int) {
|
||||
func (s *SKVMGuestInstance) SaveLiveDesc(guestDesc *desc.SGuestDesc) error {
|
||||
s.Desc = guestDesc
|
||||
|
||||
defaultGwCnt := 0
|
||||
defNics := netutils2.SNicInfoList{}
|
||||
// fill in ovn vpc nic bridge field
|
||||
for _, nic := range s.Desc.Nics {
|
||||
if nic.Bridge == "" {
|
||||
nic.Bridge = getNicBridge(nic)
|
||||
}
|
||||
if nic.IsDefault {
|
||||
defaultGwCnt++
|
||||
}
|
||||
defNics = defNics.Add(nic.Ip, nic.Mac, nic.Gateway)
|
||||
}
|
||||
|
||||
// there should 1 and only 1 default gateway
|
||||
if defaultGwCnt != 1 {
|
||||
// fix is_default
|
||||
_, defIndex := defNics.FindDefaultNicMac()
|
||||
for i := range s.Desc.Nics {
|
||||
if i == defIndex {
|
||||
s.Desc.Nics[i].IsDefault = true
|
||||
} else {
|
||||
s.Desc.Nics[i].IsDefault = false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if err := fileutils2.FilePutContents(
|
||||
|
||||
@@ -21,6 +21,7 @@ import (
|
||||
"yunion.io/x/onecloud/pkg/appsrv"
|
||||
app_common "yunion.io/x/onecloud/pkg/cloudcommon/app"
|
||||
"yunion.io/x/onecloud/pkg/cloudcommon/cronman"
|
||||
common_options "yunion.io/x/onecloud/pkg/cloudcommon/options"
|
||||
"yunion.io/x/onecloud/pkg/cloudcommon/service"
|
||||
"yunion.io/x/onecloud/pkg/hostman/downloader"
|
||||
"yunion.io/x/onecloud/pkg/hostman/guestman"
|
||||
@@ -83,6 +84,7 @@ func (host *SHostService) RunService() {
|
||||
app_common.InitAuth(&options.HostOptions.CommonOptions, func() {
|
||||
log.Infof("Auth complete!!")
|
||||
})
|
||||
common_options.StartOptionManager(&options.HostOptions.CommonOptions, options.HostOptions.ConfigSyncPeriodSeconds, "", "", common_options.OnCommonOptionsChange)
|
||||
|
||||
deployclient.Init(options.HostOptions.DeployServerSocketPath)
|
||||
if err := storageman.Init(hostInstance); err != nil {
|
||||
|
||||
@@ -11,11 +11,10 @@
|
||||
package apis
|
||||
|
||||
import (
|
||||
reflect "reflect"
|
||||
sync "sync"
|
||||
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||
reflect "reflect"
|
||||
sync "sync"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -334,6 +333,7 @@ type Nic struct {
|
||||
LinkUp bool `protobuf:"varint,24,opt,name=link_up,json=linkUp,proto3" json:"link_up,omitempty"`
|
||||
Mtu int64 `protobuf:"varint,25,opt,name=mtu,proto3" json:"mtu,omitempty"`
|
||||
Name string `protobuf:"bytes,26,opt,name=name,proto3" json:"name,omitempty"`
|
||||
IsDefault bool `protobuf:"varint,27,opt,name=is_default,json=isDefault,proto3" json:"is_default,omitempty"`
|
||||
}
|
||||
|
||||
func (x *Nic) Reset() {
|
||||
@@ -550,6 +550,13 @@ func (x *Nic) GetName() string {
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *Nic) GetIsDefault() bool {
|
||||
if x != nil {
|
||||
return x.IsDefault
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
type VDDKConInfo struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
@@ -1867,7 +1874,7 @@ var file_deploy_proto_rawDesc = []byte{
|
||||
0x01, 0x28, 0x09, 0x52, 0x02, 0x66, 0x73, 0x12, 0x1e, 0x0a, 0x0a, 0x6d, 0x6f, 0x75, 0x6e, 0x74,
|
||||
0x70, 0x6f, 0x69, 0x6e, 0x74, 0x18, 0x10, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x6d, 0x6f, 0x75,
|
||||
0x6e, 0x74, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x64, 0x65, 0x76, 0x18, 0x11,
|
||||
0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x64, 0x65, 0x76, 0x22, 0xea, 0x04, 0x0a, 0x03, 0x4e, 0x69,
|
||||
0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x64, 0x65, 0x76, 0x22, 0x89, 0x05, 0x0a, 0x03, 0x4e, 0x69,
|
||||
0x63, 0x12, 0x10, 0x0a, 0x03, 0x6d, 0x61, 0x63, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03,
|
||||
0x6d, 0x61, 0x63, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52,
|
||||
0x02, 0x69, 0x70, 0x12, 0x10, 0x0a, 0x03, 0x6e, 0x65, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09,
|
||||
@@ -1906,206 +1913,208 @@ var file_deploy_proto_rawDesc = []byte{
|
||||
0x75, 0x70, 0x18, 0x18, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x6c, 0x69, 0x6e, 0x6b, 0x55, 0x70,
|
||||
0x12, 0x10, 0x0a, 0x03, 0x6d, 0x74, 0x75, 0x18, 0x19, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x6d,
|
||||
0x74, 0x75, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x1a, 0x20, 0x01, 0x28, 0x09,
|
||||
0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x77, 0x0a, 0x0b, 0x56, 0x44, 0x44, 0x4b, 0x43, 0x6f,
|
||||
0x6e, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x12, 0x0a, 0x04, 0x68, 0x6f, 0x73, 0x74, 0x18, 0x01, 0x20,
|
||||
0x01, 0x28, 0x09, 0x52, 0x04, 0x68, 0x6f, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x6f, 0x72,
|
||||
0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x70, 0x6f, 0x72, 0x74, 0x12, 0x12, 0x0a,
|
||||
0x04, 0x75, 0x73, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x75, 0x73, 0x65,
|
||||
0x72, 0x12, 0x16, 0x0a, 0x06, 0x70, 0x61, 0x73, 0x73, 0x77, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28,
|
||||
0x09, 0x52, 0x06, 0x70, 0x61, 0x73, 0x73, 0x77, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x6d, 0x72,
|
||||
0x65, 0x66, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x6d, 0x72, 0x65, 0x66, 0x22,
|
||||
0xc0, 0x03, 0x0a, 0x0a, 0x44, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x2c,
|
||||
0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x69, 0x73, 0x5f, 0x64, 0x65, 0x66,
|
||||
0x61, 0x75, 0x6c, 0x74, 0x18, 0x1b, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x69, 0x73, 0x44, 0x65,
|
||||
0x66, 0x61, 0x75, 0x6c, 0x74, 0x22, 0x77, 0x0a, 0x0b, 0x56, 0x44, 0x44, 0x4b, 0x43, 0x6f, 0x6e,
|
||||
0x49, 0x6e, 0x66, 0x6f, 0x12, 0x12, 0x0a, 0x04, 0x68, 0x6f, 0x73, 0x74, 0x18, 0x01, 0x20, 0x01,
|
||||
0x28, 0x09, 0x52, 0x04, 0x68, 0x6f, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x6f, 0x72, 0x74,
|
||||
0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x70, 0x6f, 0x72, 0x74, 0x12, 0x12, 0x0a, 0x04,
|
||||
0x75, 0x73, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x75, 0x73, 0x65, 0x72,
|
||||
0x12, 0x16, 0x0a, 0x06, 0x70, 0x61, 0x73, 0x73, 0x77, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09,
|
||||
0x52, 0x06, 0x70, 0x61, 0x73, 0x73, 0x77, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x6d, 0x72, 0x65,
|
||||
0x66, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x6d, 0x72, 0x65, 0x66, 0x22, 0xc0,
|
||||
0x03, 0x0a, 0x0a, 0x44, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x2c, 0x0a,
|
||||
0x0a, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28,
|
||||
0x0b, 0x32, 0x0d, 0x2e, 0x61, 0x70, 0x69, 0x73, 0x2e, 0x53, 0x53, 0x48, 0x4b, 0x65, 0x79, 0x73,
|
||||
0x52, 0x09, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x12, 0x2d, 0x0a, 0x07, 0x64,
|
||||
0x65, 0x70, 0x6c, 0x6f, 0x79, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x61,
|
||||
0x70, 0x69, 0x73, 0x2e, 0x44, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e,
|
||||
0x74, 0x52, 0x07, 0x64, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x61,
|
||||
0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x61,
|
||||
0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x12, 0x17, 0x0a, 0x07, 0x69, 0x73, 0x5f, 0x69, 0x6e, 0x69,
|
||||
0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x69, 0x73, 0x49, 0x6e, 0x69, 0x74, 0x12,
|
||||
0x1d, 0x0a, 0x0a, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x74, 0x74, 0x79, 0x18, 0x05, 0x20,
|
||||
0x01, 0x28, 0x08, 0x52, 0x09, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x54, 0x74, 0x79, 0x12, 0x2a,
|
||||
0x0a, 0x11, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x5f, 0x72, 0x6f, 0x6f, 0x74, 0x5f, 0x75,
|
||||
0x73, 0x65, 0x72, 0x18, 0x06, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0f, 0x64, 0x65, 0x66, 0x61, 0x75,
|
||||
0x6c, 0x74, 0x52, 0x6f, 0x6f, 0x74, 0x55, 0x73, 0x65, 0x72, 0x12, 0x3b, 0x0a, 0x1a, 0x77, 0x69,
|
||||
0x6e, 0x64, 0x6f, 0x77, 0x73, 0x5f, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x5f, 0x61, 0x64,
|
||||
0x6d, 0x69, 0x6e, 0x5f, 0x75, 0x73, 0x65, 0x72, 0x18, 0x07, 0x20, 0x01, 0x28, 0x08, 0x52, 0x17,
|
||||
0x77, 0x69, 0x6e, 0x64, 0x6f, 0x77, 0x73, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x41, 0x64,
|
||||
0x6d, 0x69, 0x6e, 0x55, 0x73, 0x65, 0x72, 0x12, 0x2a, 0x0a, 0x11, 0x65, 0x6e, 0x61, 0x62, 0x6c,
|
||||
0x65, 0x5f, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x5f, 0x69, 0x6e, 0x69, 0x74, 0x18, 0x08, 0x20, 0x01,
|
||||
0x28, 0x08, 0x52, 0x0f, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x43, 0x6c, 0x6f, 0x75, 0x64, 0x49,
|
||||
0x6e, 0x69, 0x74, 0x12, 0x23, 0x0a, 0x0d, 0x6c, 0x6f, 0x67, 0x69, 0x6e, 0x5f, 0x61, 0x63, 0x63,
|
||||
0x6f, 0x75, 0x6e, 0x74, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x6c, 0x6f, 0x67, 0x69,
|
||||
0x6e, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x2a, 0x0a, 0x08, 0x74, 0x65, 0x6c, 0x65,
|
||||
0x67, 0x72, 0x61, 0x66, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x61, 0x70, 0x69,
|
||||
0x73, 0x2e, 0x54, 0x65, 0x6c, 0x65, 0x67, 0x72, 0x61, 0x66, 0x52, 0x08, 0x74, 0x65, 0x6c, 0x65,
|
||||
0x67, 0x72, 0x61, 0x66, 0x12, 0x1b, 0x0a, 0x09, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x64, 0x61, 0x74,
|
||||
0x61, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x75, 0x73, 0x65, 0x72, 0x44, 0x61, 0x74,
|
||||
0x61, 0x22, 0x2f, 0x0a, 0x08, 0x54, 0x65, 0x6c, 0x65, 0x67, 0x72, 0x61, 0x66, 0x12, 0x23, 0x0a,
|
||||
0x0d, 0x74, 0x65, 0x6c, 0x65, 0x67, 0x72, 0x61, 0x66, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x18, 0x01,
|
||||
0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x74, 0x65, 0x6c, 0x65, 0x67, 0x72, 0x61, 0x66, 0x43, 0x6f,
|
||||
0x6e, 0x66, 0x22, 0xac, 0x01, 0x0a, 0x07, 0x53, 0x53, 0x48, 0x4b, 0x65, 0x79, 0x73, 0x12, 0x1d,
|
||||
0x0a, 0x0a, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01,
|
||||
0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x61, 0x70, 0x69, 0x73, 0x2e, 0x53, 0x53, 0x48, 0x4b, 0x65, 0x79,
|
||||
0x73, 0x52, 0x09, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x12, 0x2d, 0x0a, 0x07,
|
||||
0x64, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x13, 0x2e,
|
||||
0x61, 0x70, 0x69, 0x73, 0x2e, 0x44, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x43, 0x6f, 0x6e, 0x74, 0x65,
|
||||
0x6e, 0x74, 0x52, 0x07, 0x64, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x70,
|
||||
0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70,
|
||||
0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x12, 0x17, 0x0a, 0x07, 0x69, 0x73, 0x5f, 0x69, 0x6e,
|
||||
0x69, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x69, 0x73, 0x49, 0x6e, 0x69, 0x74,
|
||||
0x12, 0x1d, 0x0a, 0x0a, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x74, 0x74, 0x79, 0x18, 0x05,
|
||||
0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x54, 0x74, 0x79, 0x12,
|
||||
0x2a, 0x0a, 0x11, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x5f, 0x72, 0x6f, 0x6f, 0x74, 0x5f,
|
||||
0x75, 0x73, 0x65, 0x72, 0x18, 0x06, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0f, 0x64, 0x65, 0x66, 0x61,
|
||||
0x75, 0x6c, 0x74, 0x52, 0x6f, 0x6f, 0x74, 0x55, 0x73, 0x65, 0x72, 0x12, 0x3b, 0x0a, 0x1a, 0x77,
|
||||
0x69, 0x6e, 0x64, 0x6f, 0x77, 0x73, 0x5f, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x5f, 0x61,
|
||||
0x64, 0x6d, 0x69, 0x6e, 0x5f, 0x75, 0x73, 0x65, 0x72, 0x18, 0x07, 0x20, 0x01, 0x28, 0x08, 0x52,
|
||||
0x17, 0x77, 0x69, 0x6e, 0x64, 0x6f, 0x77, 0x73, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x41,
|
||||
0x64, 0x6d, 0x69, 0x6e, 0x55, 0x73, 0x65, 0x72, 0x12, 0x2a, 0x0a, 0x11, 0x65, 0x6e, 0x61, 0x62,
|
||||
0x6c, 0x65, 0x5f, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x5f, 0x69, 0x6e, 0x69, 0x74, 0x18, 0x08, 0x20,
|
||||
0x01, 0x28, 0x08, 0x52, 0x0f, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x43, 0x6c, 0x6f, 0x75, 0x64,
|
||||
0x49, 0x6e, 0x69, 0x74, 0x12, 0x23, 0x0a, 0x0d, 0x6c, 0x6f, 0x67, 0x69, 0x6e, 0x5f, 0x61, 0x63,
|
||||
0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x6c, 0x6f, 0x67,
|
||||
0x69, 0x6e, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x2a, 0x0a, 0x08, 0x74, 0x65, 0x6c,
|
||||
0x65, 0x67, 0x72, 0x61, 0x66, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x61, 0x70,
|
||||
0x69, 0x73, 0x2e, 0x54, 0x65, 0x6c, 0x65, 0x67, 0x72, 0x61, 0x66, 0x52, 0x08, 0x74, 0x65, 0x6c,
|
||||
0x65, 0x67, 0x72, 0x61, 0x66, 0x12, 0x1b, 0x0a, 0x09, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x64, 0x61,
|
||||
0x74, 0x61, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x75, 0x73, 0x65, 0x72, 0x44, 0x61,
|
||||
0x74, 0x61, 0x22, 0x2f, 0x0a, 0x08, 0x54, 0x65, 0x6c, 0x65, 0x67, 0x72, 0x61, 0x66, 0x12, 0x23,
|
||||
0x0a, 0x0d, 0x74, 0x65, 0x6c, 0x65, 0x67, 0x72, 0x61, 0x66, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x18,
|
||||
0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x74, 0x65, 0x6c, 0x65, 0x67, 0x72, 0x61, 0x66, 0x43,
|
||||
0x6f, 0x6e, 0x66, 0x22, 0xac, 0x01, 0x0a, 0x07, 0x53, 0x53, 0x48, 0x4b, 0x65, 0x79, 0x73, 0x12,
|
||||
0x1d, 0x0a, 0x0a, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20,
|
||||
0x01, 0x28, 0x09, 0x52, 0x09, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x12, 0x2a,
|
||||
0x0a, 0x11, 0x64, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x5f, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x5f,
|
||||
0x6b, 0x65, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x64, 0x65, 0x6c, 0x65, 0x74,
|
||||
0x65, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x12, 0x28, 0x0a, 0x10, 0x61, 0x64,
|
||||
0x6d, 0x69, 0x6e, 0x5f, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x03,
|
||||
0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x50, 0x75, 0x62, 0x6c, 0x69,
|
||||
0x63, 0x4b, 0x65, 0x79, 0x12, 0x2c, 0x0a, 0x12, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x5f,
|
||||
0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09,
|
||||
0x52, 0x10, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b,
|
||||
0x65, 0x79, 0x22, 0x55, 0x0a, 0x0d, 0x44, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x43, 0x6f, 0x6e, 0x74,
|
||||
0x65, 0x6e, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x61, 0x74, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28,
|
||||
0x09, 0x52, 0x04, 0x70, 0x61, 0x74, 0x68, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65,
|
||||
0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e,
|
||||
0x74, 0x12, 0x16, 0x0a, 0x06, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28,
|
||||
0x09, 0x52, 0x06, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x07, 0x0a, 0x05, 0x45, 0x6d, 0x70,
|
||||
0x74, 0x79, 0x22, 0xe2, 0x01, 0x0a, 0x15, 0x44, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x47, 0x75, 0x65,
|
||||
0x73, 0x74, 0x46, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x16, 0x0a, 0x06,
|
||||
0x64, 0x69, 0x73, 0x74, 0x72, 0x6f, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x64, 0x69,
|
||||
0x73, 0x74, 0x72, 0x6f, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18,
|
||||
0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x12,
|
||||
0x0a, 0x04, 0x61, 0x72, 0x63, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x61, 0x72,
|
||||
0x63, 0x68, 0x12, 0x1a, 0x0a, 0x08, 0x6c, 0x61, 0x6e, 0x67, 0x75, 0x61, 0x67, 0x65, 0x18, 0x04,
|
||||
0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6c, 0x61, 0x6e, 0x67, 0x75, 0x61, 0x67, 0x65, 0x12, 0x0e,
|
||||
0x0a, 0x02, 0x6f, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x6f, 0x73, 0x12, 0x18,
|
||||
0x0a, 0x07, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52,
|
||||
0x07, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18,
|
||||
0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x2b, 0x0a, 0x11, 0x74, 0x65,
|
||||
0x6c, 0x65, 0x67, 0x72, 0x61, 0x66, 0x5f, 0x64, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x65, 0x64, 0x18,
|
||||
0x08, 0x20, 0x01, 0x28, 0x08, 0x52, 0x10, 0x74, 0x65, 0x6c, 0x65, 0x67, 0x72, 0x61, 0x66, 0x44,
|
||||
0x65, 0x70, 0x6c, 0x6f, 0x79, 0x65, 0x64, 0x22, 0x91, 0x01, 0x0a, 0x08, 0x44, 0x69, 0x73, 0x6b,
|
||||
0x49, 0x6e, 0x66, 0x6f, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x61, 0x74, 0x68, 0x18, 0x01, 0x20, 0x01,
|
||||
0x28, 0x09, 0x52, 0x04, 0x70, 0x61, 0x74, 0x68, 0x12, 0x29, 0x0a, 0x10, 0x65, 0x6e, 0x63, 0x72,
|
||||
0x79, 0x70, 0x74, 0x5f, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x18, 0x02, 0x20, 0x01,
|
||||
0x28, 0x09, 0x52, 0x0f, 0x65, 0x6e, 0x63, 0x72, 0x79, 0x70, 0x74, 0x50, 0x61, 0x73, 0x73, 0x77,
|
||||
0x6f, 0x72, 0x64, 0x12, 0x25, 0x0a, 0x0e, 0x65, 0x6e, 0x63, 0x72, 0x79, 0x70, 0x74, 0x5f, 0x66,
|
||||
0x6f, 0x72, 0x6d, 0x61, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x65, 0x6e, 0x63,
|
||||
0x72, 0x79, 0x70, 0x74, 0x46, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x12, 0x1f, 0x0a, 0x0b, 0x65, 0x6e,
|
||||
0x63, 0x72, 0x79, 0x70, 0x74, 0x5f, 0x61, 0x6c, 0x67, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52,
|
||||
0x0a, 0x65, 0x6e, 0x63, 0x72, 0x79, 0x70, 0x74, 0x41, 0x6c, 0x67, 0x22, 0xce, 0x01, 0x0a, 0x0c,
|
||||
0x44, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x2b, 0x0a, 0x09,
|
||||
0x64, 0x69, 0x73, 0x6b, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32,
|
||||
0x0e, 0x2e, 0x61, 0x70, 0x69, 0x73, 0x2e, 0x44, 0x69, 0x73, 0x6b, 0x49, 0x6e, 0x66, 0x6f, 0x52,
|
||||
0x08, 0x64, 0x69, 0x73, 0x6b, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x2e, 0x0a, 0x0a, 0x67, 0x75, 0x65,
|
||||
0x73, 0x74, 0x5f, 0x64, 0x65, 0x73, 0x63, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e,
|
||||
0x61, 0x70, 0x69, 0x73, 0x2e, 0x47, 0x75, 0x65, 0x73, 0x74, 0x44, 0x65, 0x73, 0x63, 0x52, 0x09,
|
||||
0x67, 0x75, 0x65, 0x73, 0x74, 0x44, 0x65, 0x73, 0x63, 0x12, 0x31, 0x0a, 0x0b, 0x64, 0x65, 0x70,
|
||||
0x6c, 0x6f, 0x79, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10,
|
||||
0x2e, 0x61, 0x70, 0x69, 0x73, 0x2e, 0x44, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x49, 0x6e, 0x66, 0x6f,
|
||||
0x52, 0x0a, 0x64, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x2e, 0x0a, 0x09,
|
||||
0x76, 0x64, 0x64, 0x6b, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32,
|
||||
0x11, 0x2e, 0x61, 0x70, 0x69, 0x73, 0x2e, 0x56, 0x44, 0x44, 0x4b, 0x43, 0x6f, 0x6e, 0x49, 0x6e,
|
||||
0x66, 0x6f, 0x52, 0x08, 0x76, 0x64, 0x64, 0x6b, 0x49, 0x6e, 0x66, 0x6f, 0x22, 0x8d, 0x01, 0x0a,
|
||||
0x0e, 0x52, 0x65, 0x73, 0x69, 0x7a, 0x65, 0x46, 0x73, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12,
|
||||
0x2b, 0x0a, 0x09, 0x64, 0x69, 0x73, 0x6b, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x01, 0x20, 0x01,
|
||||
0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x61, 0x70, 0x69, 0x73, 0x2e, 0x44, 0x69, 0x73, 0x6b, 0x49, 0x6e,
|
||||
0x66, 0x6f, 0x52, 0x08, 0x64, 0x69, 0x73, 0x6b, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x1e, 0x0a, 0x0a,
|
||||
0x68, 0x79, 0x70, 0x65, 0x72, 0x76, 0x69, 0x73, 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09,
|
||||
0x52, 0x0a, 0x68, 0x79, 0x70, 0x65, 0x72, 0x76, 0x69, 0x73, 0x6f, 0x72, 0x12, 0x2e, 0x0a, 0x09,
|
||||
0x76, 0x64, 0x64, 0x6b, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32,
|
||||
0x11, 0x2e, 0x61, 0x70, 0x69, 0x73, 0x2e, 0x56, 0x44, 0x44, 0x4b, 0x43, 0x6f, 0x6e, 0x49, 0x6e,
|
||||
0x66, 0x6f, 0x52, 0x08, 0x76, 0x64, 0x64, 0x6b, 0x49, 0x6e, 0x66, 0x6f, 0x22, 0x6e, 0x0a, 0x0e,
|
||||
0x46, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x46, 0x73, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x2b,
|
||||
0x0a, 0x09, 0x64, 0x69, 0x73, 0x6b, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x01, 0x20, 0x01, 0x28,
|
||||
0x0b, 0x32, 0x0e, 0x2e, 0x61, 0x70, 0x69, 0x73, 0x2e, 0x44, 0x69, 0x73, 0x6b, 0x49, 0x6e, 0x66,
|
||||
0x6f, 0x52, 0x08, 0x64, 0x69, 0x73, 0x6b, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x1b, 0x0a, 0x09, 0x66,
|
||||
0x73, 0x5f, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08,
|
||||
0x66, 0x73, 0x46, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x75, 0x75, 0x69, 0x64,
|
||||
0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x75, 0x75, 0x69, 0x64, 0x22, 0x6f, 0x0a, 0x0b,
|
||||
0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x16, 0x0a, 0x06, 0x64,
|
||||
0x28, 0x09, 0x52, 0x09, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x12, 0x2a, 0x0a,
|
||||
0x11, 0x64, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x5f, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x5f, 0x6b,
|
||||
0x65, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x64, 0x65, 0x6c, 0x65, 0x74, 0x65,
|
||||
0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x12, 0x28, 0x0a, 0x10, 0x61, 0x64, 0x6d,
|
||||
0x69, 0x6e, 0x5f, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x03, 0x20,
|
||||
0x01, 0x28, 0x09, 0x52, 0x0e, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63,
|
||||
0x4b, 0x65, 0x79, 0x12, 0x2c, 0x0a, 0x12, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x70,
|
||||
0x75, 0x62, 0x6c, 0x69, 0x63, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52,
|
||||
0x10, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65,
|
||||
0x79, 0x22, 0x55, 0x0a, 0x0d, 0x44, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x43, 0x6f, 0x6e, 0x74, 0x65,
|
||||
0x6e, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x61, 0x74, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09,
|
||||
0x52, 0x04, 0x70, 0x61, 0x74, 0x68, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e,
|
||||
0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74,
|
||||
0x12, 0x16, 0x0a, 0x06, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09,
|
||||
0x52, 0x06, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x07, 0x0a, 0x05, 0x45, 0x6d, 0x70, 0x74,
|
||||
0x79, 0x22, 0xe2, 0x01, 0x0a, 0x15, 0x44, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x47, 0x75, 0x65, 0x73,
|
||||
0x74, 0x46, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x64,
|
||||
0x69, 0x73, 0x74, 0x72, 0x6f, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x64, 0x69, 0x73,
|
||||
0x74, 0x72, 0x6f, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02,
|
||||
0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x12, 0x0a,
|
||||
0x04, 0x61, 0x72, 0x63, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x61, 0x72, 0x63,
|
||||
0x68, 0x12, 0x1a, 0x0a, 0x08, 0x6c, 0x61, 0x6e, 0x67, 0x75, 0x61, 0x67, 0x65, 0x18, 0x04, 0x20,
|
||||
0x01, 0x28, 0x09, 0x52, 0x08, 0x6c, 0x61, 0x6e, 0x67, 0x75, 0x61, 0x67, 0x65, 0x22, 0x5d, 0x0a,
|
||||
0x12, 0x53, 0x61, 0x76, 0x65, 0x54, 0x6f, 0x47, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x50, 0x61, 0x72,
|
||||
0x61, 0x6d, 0x73, 0x12, 0x2b, 0x0a, 0x09, 0x64, 0x69, 0x73, 0x6b, 0x5f, 0x69, 0x6e, 0x66, 0x6f,
|
||||
0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x61, 0x70, 0x69, 0x73, 0x2e, 0x44, 0x69,
|
||||
0x73, 0x6b, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x08, 0x64, 0x69, 0x73, 0x6b, 0x49, 0x6e, 0x66, 0x6f,
|
||||
0x12, 0x1a, 0x0a, 0x08, 0x63, 0x6f, 0x6d, 0x70, 0x72, 0x65, 0x73, 0x73, 0x18, 0x02, 0x20, 0x01,
|
||||
0x28, 0x08, 0x52, 0x08, 0x63, 0x6f, 0x6d, 0x70, 0x72, 0x65, 0x73, 0x73, 0x22, 0x65, 0x0a, 0x14,
|
||||
0x53, 0x61, 0x76, 0x65, 0x54, 0x6f, 0x47, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70,
|
||||
0x6f, 0x6e, 0x73, 0x65, 0x12, 0x17, 0x0a, 0x07, 0x6f, 0x73, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x18,
|
||||
0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x6f, 0x73, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x34, 0x0a,
|
||||
0x0c, 0x72, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x02, 0x20,
|
||||
0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x61, 0x70, 0x69, 0x73, 0x2e, 0x52, 0x65, 0x6c, 0x65, 0x61,
|
||||
0x73, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x0b, 0x72, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x49,
|
||||
0x6e, 0x66, 0x6f, 0x22, 0x43, 0x0a, 0x14, 0x50, 0x72, 0x6f, 0x62, 0x65, 0x49, 0x6d, 0x61, 0x67,
|
||||
0x65, 0x49, 0x6e, 0x66, 0x6f, 0x50, 0x72, 0x61, 0x6d, 0x61, 0x73, 0x12, 0x2b, 0x0a, 0x09, 0x64,
|
||||
0x01, 0x28, 0x09, 0x52, 0x08, 0x6c, 0x61, 0x6e, 0x67, 0x75, 0x61, 0x67, 0x65, 0x12, 0x0e, 0x0a,
|
||||
0x02, 0x6f, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x6f, 0x73, 0x12, 0x18, 0x0a,
|
||||
0x07, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07,
|
||||
0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x07,
|
||||
0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x2b, 0x0a, 0x11, 0x74, 0x65, 0x6c,
|
||||
0x65, 0x67, 0x72, 0x61, 0x66, 0x5f, 0x64, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x65, 0x64, 0x18, 0x08,
|
||||
0x20, 0x01, 0x28, 0x08, 0x52, 0x10, 0x74, 0x65, 0x6c, 0x65, 0x67, 0x72, 0x61, 0x66, 0x44, 0x65,
|
||||
0x70, 0x6c, 0x6f, 0x79, 0x65, 0x64, 0x22, 0x91, 0x01, 0x0a, 0x08, 0x44, 0x69, 0x73, 0x6b, 0x49,
|
||||
0x6e, 0x66, 0x6f, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x61, 0x74, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28,
|
||||
0x09, 0x52, 0x04, 0x70, 0x61, 0x74, 0x68, 0x12, 0x29, 0x0a, 0x10, 0x65, 0x6e, 0x63, 0x72, 0x79,
|
||||
0x70, 0x74, 0x5f, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28,
|
||||
0x09, 0x52, 0x0f, 0x65, 0x6e, 0x63, 0x72, 0x79, 0x70, 0x74, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f,
|
||||
0x72, 0x64, 0x12, 0x25, 0x0a, 0x0e, 0x65, 0x6e, 0x63, 0x72, 0x79, 0x70, 0x74, 0x5f, 0x66, 0x6f,
|
||||
0x72, 0x6d, 0x61, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x65, 0x6e, 0x63, 0x72,
|
||||
0x79, 0x70, 0x74, 0x46, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x12, 0x1f, 0x0a, 0x0b, 0x65, 0x6e, 0x63,
|
||||
0x72, 0x79, 0x70, 0x74, 0x5f, 0x61, 0x6c, 0x67, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a,
|
||||
0x65, 0x6e, 0x63, 0x72, 0x79, 0x70, 0x74, 0x41, 0x6c, 0x67, 0x22, 0xce, 0x01, 0x0a, 0x0c, 0x44,
|
||||
0x65, 0x70, 0x6c, 0x6f, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x2b, 0x0a, 0x09, 0x64,
|
||||
0x69, 0x73, 0x6b, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e,
|
||||
0x2e, 0x61, 0x70, 0x69, 0x73, 0x2e, 0x44, 0x69, 0x73, 0x6b, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x08,
|
||||
0x64, 0x69, 0x73, 0x6b, 0x49, 0x6e, 0x66, 0x6f, 0x22, 0xb2, 0x02, 0x0a, 0x09, 0x49, 0x6d, 0x61,
|
||||
0x67, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x2a, 0x0a, 0x07, 0x6f, 0x73, 0x5f, 0x69, 0x6e, 0x66,
|
||||
0x6f, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x61, 0x70, 0x69, 0x73, 0x2e, 0x52,
|
||||
0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x06, 0x6f, 0x73, 0x49, 0x6e,
|
||||
0x66, 0x6f, 0x12, 0x17, 0x0a, 0x07, 0x6f, 0x73, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20,
|
||||
0x01, 0x28, 0x09, 0x52, 0x06, 0x6f, 0x73, 0x54, 0x79, 0x70, 0x65, 0x12, 0x26, 0x0a, 0x0f, 0x69,
|
||||
0x73, 0x5f, 0x75, 0x65, 0x66, 0x69, 0x5f, 0x73, 0x75, 0x70, 0x70, 0x6f, 0x72, 0x74, 0x18, 0x03,
|
||||
0x20, 0x01, 0x28, 0x08, 0x52, 0x0d, 0x69, 0x73, 0x55, 0x65, 0x66, 0x69, 0x53, 0x75, 0x70, 0x70,
|
||||
0x6f, 0x72, 0x74, 0x12, 0x28, 0x0a, 0x10, 0x69, 0x73, 0x5f, 0x6c, 0x76, 0x6d, 0x5f, 0x70, 0x61,
|
||||
0x72, 0x74, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0e, 0x69,
|
||||
0x73, 0x4c, 0x76, 0x6d, 0x50, 0x61, 0x72, 0x74, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1f, 0x0a,
|
||||
0x0b, 0x69, 0x73, 0x5f, 0x72, 0x65, 0x61, 0x64, 0x6f, 0x6e, 0x6c, 0x79, 0x18, 0x05, 0x20, 0x01,
|
||||
0x28, 0x08, 0x52, 0x0a, 0x69, 0x73, 0x52, 0x65, 0x61, 0x64, 0x6f, 0x6e, 0x6c, 0x79, 0x12, 0x36,
|
||||
0x0a, 0x17, 0x70, 0x68, 0x79, 0x73, 0x69, 0x63, 0x61, 0x6c, 0x5f, 0x70, 0x61, 0x72, 0x74, 0x69,
|
||||
0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52,
|
||||
0x15, 0x70, 0x68, 0x79, 0x73, 0x69, 0x63, 0x61, 0x6c, 0x50, 0x61, 0x72, 0x74, 0x69, 0x74, 0x69,
|
||||
0x6f, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x12, 0x35, 0x0a, 0x17, 0x69, 0x73, 0x5f, 0x69, 0x6e, 0x73,
|
||||
0x74, 0x61, 0x6c, 0x6c, 0x65, 0x64, 0x5f, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x5f, 0x69, 0x6e, 0x69,
|
||||
0x74, 0x18, 0x07, 0x20, 0x01, 0x28, 0x08, 0x52, 0x14, 0x69, 0x73, 0x49, 0x6e, 0x73, 0x74, 0x61,
|
||||
0x6c, 0x6c, 0x65, 0x64, 0x43, 0x6c, 0x6f, 0x75, 0x64, 0x49, 0x6e, 0x69, 0x74, 0x22, 0x2b, 0x0a,
|
||||
0x0c, 0x45, 0x73, 0x78, 0x69, 0x44, 0x69, 0x73, 0x6b, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x1b, 0x0a,
|
||||
0x09, 0x64, 0x69, 0x73, 0x6b, 0x5f, 0x70, 0x61, 0x74, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09,
|
||||
0x52, 0x08, 0x64, 0x69, 0x73, 0x6b, 0x50, 0x61, 0x74, 0x68, 0x22, 0x7d, 0x0a, 0x16, 0x43, 0x6f,
|
||||
0x64, 0x69, 0x73, 0x6b, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x2e, 0x0a, 0x0a, 0x67, 0x75, 0x65, 0x73,
|
||||
0x74, 0x5f, 0x64, 0x65, 0x73, 0x63, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x61,
|
||||
0x70, 0x69, 0x73, 0x2e, 0x47, 0x75, 0x65, 0x73, 0x74, 0x44, 0x65, 0x73, 0x63, 0x52, 0x09, 0x67,
|
||||
0x75, 0x65, 0x73, 0x74, 0x44, 0x65, 0x73, 0x63, 0x12, 0x31, 0x0a, 0x0b, 0x64, 0x65, 0x70, 0x6c,
|
||||
0x6f, 0x79, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e,
|
||||
0x61, 0x70, 0x69, 0x73, 0x2e, 0x44, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x49, 0x6e, 0x66, 0x6f, 0x52,
|
||||
0x0a, 0x64, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x2e, 0x0a, 0x09, 0x76,
|
||||
0x64, 0x64, 0x6b, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11,
|
||||
0x2e, 0x61, 0x70, 0x69, 0x73, 0x2e, 0x56, 0x44, 0x44, 0x4b, 0x43, 0x6f, 0x6e, 0x49, 0x6e, 0x66,
|
||||
0x6f, 0x52, 0x08, 0x76, 0x64, 0x64, 0x6b, 0x49, 0x6e, 0x66, 0x6f, 0x22, 0x8d, 0x01, 0x0a, 0x0e,
|
||||
0x52, 0x65, 0x73, 0x69, 0x7a, 0x65, 0x46, 0x73, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x2b,
|
||||
0x0a, 0x09, 0x64, 0x69, 0x73, 0x6b, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x01, 0x20, 0x01, 0x28,
|
||||
0x0b, 0x32, 0x0e, 0x2e, 0x61, 0x70, 0x69, 0x73, 0x2e, 0x44, 0x69, 0x73, 0x6b, 0x49, 0x6e, 0x66,
|
||||
0x6f, 0x52, 0x08, 0x64, 0x69, 0x73, 0x6b, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x1e, 0x0a, 0x0a, 0x68,
|
||||
0x79, 0x70, 0x65, 0x72, 0x76, 0x69, 0x73, 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52,
|
||||
0x0a, 0x68, 0x79, 0x70, 0x65, 0x72, 0x76, 0x69, 0x73, 0x6f, 0x72, 0x12, 0x2e, 0x0a, 0x09, 0x76,
|
||||
0x64, 0x64, 0x6b, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11,
|
||||
0x2e, 0x61, 0x70, 0x69, 0x73, 0x2e, 0x56, 0x44, 0x44, 0x4b, 0x43, 0x6f, 0x6e, 0x49, 0x6e, 0x66,
|
||||
0x6f, 0x52, 0x08, 0x76, 0x64, 0x64, 0x6b, 0x49, 0x6e, 0x66, 0x6f, 0x22, 0x6e, 0x0a, 0x0e, 0x46,
|
||||
0x6f, 0x72, 0x6d, 0x61, 0x74, 0x46, 0x73, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x2b, 0x0a,
|
||||
0x09, 0x64, 0x69, 0x73, 0x6b, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b,
|
||||
0x32, 0x0e, 0x2e, 0x61, 0x70, 0x69, 0x73, 0x2e, 0x44, 0x69, 0x73, 0x6b, 0x49, 0x6e, 0x66, 0x6f,
|
||||
0x52, 0x08, 0x64, 0x69, 0x73, 0x6b, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x1b, 0x0a, 0x09, 0x66, 0x73,
|
||||
0x5f, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x66,
|
||||
0x73, 0x46, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x75, 0x75, 0x69, 0x64, 0x18,
|
||||
0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x75, 0x75, 0x69, 0x64, 0x22, 0x6f, 0x0a, 0x0b, 0x52,
|
||||
0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x16, 0x0a, 0x06, 0x64, 0x69,
|
||||
0x73, 0x74, 0x72, 0x6f, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x64, 0x69, 0x73, 0x74,
|
||||
0x72, 0x6f, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20,
|
||||
0x01, 0x28, 0x09, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x12, 0x0a, 0x04,
|
||||
0x61, 0x72, 0x63, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x61, 0x72, 0x63, 0x68,
|
||||
0x12, 0x1a, 0x0a, 0x08, 0x6c, 0x61, 0x6e, 0x67, 0x75, 0x61, 0x67, 0x65, 0x18, 0x04, 0x20, 0x01,
|
||||
0x28, 0x09, 0x52, 0x08, 0x6c, 0x61, 0x6e, 0x67, 0x75, 0x61, 0x67, 0x65, 0x22, 0x5d, 0x0a, 0x12,
|
||||
0x53, 0x61, 0x76, 0x65, 0x54, 0x6f, 0x47, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x50, 0x61, 0x72, 0x61,
|
||||
0x6d, 0x73, 0x12, 0x2b, 0x0a, 0x09, 0x64, 0x69, 0x73, 0x6b, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x18,
|
||||
0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x61, 0x70, 0x69, 0x73, 0x2e, 0x44, 0x69, 0x73,
|
||||
0x6b, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x08, 0x64, 0x69, 0x73, 0x6b, 0x49, 0x6e, 0x66, 0x6f, 0x12,
|
||||
0x1a, 0x0a, 0x08, 0x63, 0x6f, 0x6d, 0x70, 0x72, 0x65, 0x73, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28,
|
||||
0x08, 0x52, 0x08, 0x63, 0x6f, 0x6d, 0x70, 0x72, 0x65, 0x73, 0x73, 0x22, 0x65, 0x0a, 0x14, 0x53,
|
||||
0x61, 0x76, 0x65, 0x54, 0x6f, 0x47, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f,
|
||||
0x6e, 0x73, 0x65, 0x12, 0x17, 0x0a, 0x07, 0x6f, 0x73, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x01,
|
||||
0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x6f, 0x73, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x34, 0x0a, 0x0c,
|
||||
0x72, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x02, 0x20, 0x01,
|
||||
0x28, 0x0b, 0x32, 0x11, 0x2e, 0x61, 0x70, 0x69, 0x73, 0x2e, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73,
|
||||
0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x0b, 0x72, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x49, 0x6e,
|
||||
0x66, 0x6f, 0x22, 0x43, 0x0a, 0x14, 0x50, 0x72, 0x6f, 0x62, 0x65, 0x49, 0x6d, 0x61, 0x67, 0x65,
|
||||
0x49, 0x6e, 0x66, 0x6f, 0x50, 0x72, 0x61, 0x6d, 0x61, 0x73, 0x12, 0x2b, 0x0a, 0x09, 0x64, 0x69,
|
||||
0x73, 0x6b, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e,
|
||||
0x61, 0x70, 0x69, 0x73, 0x2e, 0x44, 0x69, 0x73, 0x6b, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x08, 0x64,
|
||||
0x69, 0x73, 0x6b, 0x49, 0x6e, 0x66, 0x6f, 0x22, 0xb2, 0x02, 0x0a, 0x09, 0x49, 0x6d, 0x61, 0x67,
|
||||
0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x2a, 0x0a, 0x07, 0x6f, 0x73, 0x5f, 0x69, 0x6e, 0x66, 0x6f,
|
||||
0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x61, 0x70, 0x69, 0x73, 0x2e, 0x52, 0x65,
|
||||
0x6c, 0x65, 0x61, 0x73, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x06, 0x6f, 0x73, 0x49, 0x6e, 0x66,
|
||||
0x6f, 0x12, 0x17, 0x0a, 0x07, 0x6f, 0x73, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01,
|
||||
0x28, 0x09, 0x52, 0x06, 0x6f, 0x73, 0x54, 0x79, 0x70, 0x65, 0x12, 0x26, 0x0a, 0x0f, 0x69, 0x73,
|
||||
0x5f, 0x75, 0x65, 0x66, 0x69, 0x5f, 0x73, 0x75, 0x70, 0x70, 0x6f, 0x72, 0x74, 0x18, 0x03, 0x20,
|
||||
0x01, 0x28, 0x08, 0x52, 0x0d, 0x69, 0x73, 0x55, 0x65, 0x66, 0x69, 0x53, 0x75, 0x70, 0x70, 0x6f,
|
||||
0x72, 0x74, 0x12, 0x28, 0x0a, 0x10, 0x69, 0x73, 0x5f, 0x6c, 0x76, 0x6d, 0x5f, 0x70, 0x61, 0x72,
|
||||
0x74, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0e, 0x69, 0x73,
|
||||
0x4c, 0x76, 0x6d, 0x50, 0x61, 0x72, 0x74, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1f, 0x0a, 0x0b,
|
||||
0x69, 0x73, 0x5f, 0x72, 0x65, 0x61, 0x64, 0x6f, 0x6e, 0x6c, 0x79, 0x18, 0x05, 0x20, 0x01, 0x28,
|
||||
0x08, 0x52, 0x0a, 0x69, 0x73, 0x52, 0x65, 0x61, 0x64, 0x6f, 0x6e, 0x6c, 0x79, 0x12, 0x36, 0x0a,
|
||||
0x17, 0x70, 0x68, 0x79, 0x73, 0x69, 0x63, 0x61, 0x6c, 0x5f, 0x70, 0x61, 0x72, 0x74, 0x69, 0x74,
|
||||
0x69, 0x6f, 0x6e, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x15,
|
||||
0x70, 0x68, 0x79, 0x73, 0x69, 0x63, 0x61, 0x6c, 0x50, 0x61, 0x72, 0x74, 0x69, 0x74, 0x69, 0x6f,
|
||||
0x6e, 0x54, 0x79, 0x70, 0x65, 0x12, 0x35, 0x0a, 0x17, 0x69, 0x73, 0x5f, 0x69, 0x6e, 0x73, 0x74,
|
||||
0x61, 0x6c, 0x6c, 0x65, 0x64, 0x5f, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x5f, 0x69, 0x6e, 0x69, 0x74,
|
||||
0x18, 0x07, 0x20, 0x01, 0x28, 0x08, 0x52, 0x14, 0x69, 0x73, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6c,
|
||||
0x6c, 0x65, 0x64, 0x43, 0x6c, 0x6f, 0x75, 0x64, 0x49, 0x6e, 0x69, 0x74, 0x22, 0x2b, 0x0a, 0x0c,
|
||||
0x45, 0x73, 0x78, 0x69, 0x44, 0x69, 0x73, 0x6b, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x1b, 0x0a, 0x09,
|
||||
0x64, 0x69, 0x73, 0x6b, 0x5f, 0x70, 0x61, 0x74, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52,
|
||||
0x08, 0x64, 0x69, 0x73, 0x6b, 0x50, 0x61, 0x74, 0x68, 0x22, 0x7d, 0x0a, 0x16, 0x43, 0x6f, 0x6e,
|
||||
0x6e, 0x65, 0x63, 0x74, 0x45, 0x73, 0x78, 0x69, 0x44, 0x69, 0x73, 0x6b, 0x73, 0x50, 0x61, 0x72,
|
||||
0x61, 0x6d, 0x73, 0x12, 0x2e, 0x0a, 0x09, 0x76, 0x64, 0x64, 0x6b, 0x5f, 0x69, 0x6e, 0x66, 0x6f,
|
||||
0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x61, 0x70, 0x69, 0x73, 0x2e, 0x56, 0x44,
|
||||
0x44, 0x4b, 0x43, 0x6f, 0x6e, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x08, 0x76, 0x64, 0x64, 0x6b, 0x49,
|
||||
0x6e, 0x66, 0x6f, 0x12, 0x33, 0x0a, 0x0b, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x5f, 0x69, 0x6e,
|
||||
0x66, 0x6f, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x61, 0x70, 0x69, 0x73, 0x2e,
|
||||
0x45, 0x73, 0x78, 0x69, 0x44, 0x69, 0x73, 0x6b, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x0a, 0x61, 0x63,
|
||||
0x63, 0x65, 0x73, 0x73, 0x49, 0x6e, 0x66, 0x6f, 0x22, 0x43, 0x0a, 0x17, 0x45, 0x73, 0x78, 0x69,
|
||||
0x44, 0x69, 0x73, 0x6b, 0x73, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x49,
|
||||
0x6e, 0x66, 0x6f, 0x12, 0x28, 0x0a, 0x05, 0x64, 0x69, 0x73, 0x6b, 0x73, 0x18, 0x01, 0x20, 0x03,
|
||||
0x28, 0x0b, 0x32, 0x12, 0x2e, 0x61, 0x70, 0x69, 0x73, 0x2e, 0x45, 0x73, 0x78, 0x69, 0x44, 0x69,
|
||||
0x73, 0x6b, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x05, 0x64, 0x69, 0x73, 0x6b, 0x73, 0x32, 0xc6, 0x03,
|
||||
0x0a, 0x0b, 0x44, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x41, 0x67, 0x65, 0x6e, 0x74, 0x12, 0x40, 0x0a,
|
||||
0x0d, 0x44, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x47, 0x75, 0x65, 0x73, 0x74, 0x46, 0x73, 0x12, 0x12,
|
||||
0x2e, 0x61, 0x70, 0x69, 0x73, 0x2e, 0x44, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x50, 0x61, 0x72, 0x61,
|
||||
0x6d, 0x73, 0x1a, 0x1b, 0x2e, 0x61, 0x70, 0x69, 0x73, 0x2e, 0x44, 0x65, 0x70, 0x6c, 0x6f, 0x79,
|
||||
0x47, 0x75, 0x65, 0x73, 0x74, 0x46, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12,
|
||||
0x2d, 0x0a, 0x08, 0x52, 0x65, 0x73, 0x69, 0x7a, 0x65, 0x46, 0x73, 0x12, 0x14, 0x2e, 0x61, 0x70,
|
||||
0x69, 0x73, 0x2e, 0x52, 0x65, 0x73, 0x69, 0x7a, 0x65, 0x46, 0x73, 0x50, 0x61, 0x72, 0x61, 0x6d,
|
||||
0x73, 0x1a, 0x0b, 0x2e, 0x61, 0x70, 0x69, 0x73, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x12, 0x2d,
|
||||
0x0a, 0x08, 0x46, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x46, 0x73, 0x12, 0x14, 0x2e, 0x61, 0x70, 0x69,
|
||||
0x73, 0x2e, 0x46, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x46, 0x73, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73,
|
||||
0x1a, 0x0b, 0x2e, 0x61, 0x70, 0x69, 0x73, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x12, 0x44, 0x0a,
|
||||
0x0c, 0x53, 0x61, 0x76, 0x65, 0x54, 0x6f, 0x47, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x12, 0x18, 0x2e,
|
||||
0x61, 0x70, 0x69, 0x73, 0x2e, 0x53, 0x61, 0x76, 0x65, 0x54, 0x6f, 0x47, 0x6c, 0x61, 0x6e, 0x63,
|
||||
0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x1a, 0x1a, 0x2e, 0x61, 0x70, 0x69, 0x73, 0x2e, 0x53,
|
||||
0x61, 0x76, 0x65, 0x54, 0x6f, 0x47, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f,
|
||||
0x6e, 0x73, 0x65, 0x12, 0x3d, 0x0a, 0x0e, 0x50, 0x72, 0x6f, 0x62, 0x65, 0x49, 0x6d, 0x61, 0x67,
|
||||
0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x1a, 0x2e, 0x61, 0x70, 0x69, 0x73, 0x2e, 0x50, 0x72, 0x6f,
|
||||
0x62, 0x65, 0x49, 0x6d, 0x61, 0x67, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x50, 0x72, 0x61, 0x6d, 0x61,
|
||||
0x73, 0x1a, 0x0f, 0x2e, 0x61, 0x70, 0x69, 0x73, 0x2e, 0x49, 0x6d, 0x61, 0x67, 0x65, 0x49, 0x6e,
|
||||
0x66, 0x6f, 0x12, 0x4f, 0x0a, 0x10, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x45, 0x73, 0x78,
|
||||
0x69, 0x44, 0x69, 0x73, 0x6b, 0x73, 0x12, 0x1c, 0x2e, 0x61, 0x70, 0x69, 0x73, 0x2e, 0x43, 0x6f,
|
||||
0x6e, 0x6e, 0x65, 0x63, 0x74, 0x45, 0x73, 0x78, 0x69, 0x44, 0x69, 0x73, 0x6b, 0x73, 0x50, 0x61,
|
||||
0x72, 0x61, 0x6d, 0x73, 0x12, 0x2e, 0x0a, 0x09, 0x76, 0x64, 0x64, 0x6b, 0x5f, 0x69, 0x6e, 0x66,
|
||||
0x6f, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x61, 0x70, 0x69, 0x73, 0x2e, 0x56,
|
||||
0x44, 0x44, 0x4b, 0x43, 0x6f, 0x6e, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x08, 0x76, 0x64, 0x64, 0x6b,
|
||||
0x49, 0x6e, 0x66, 0x6f, 0x12, 0x33, 0x0a, 0x0b, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x5f, 0x69,
|
||||
0x6e, 0x66, 0x6f, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x61, 0x70, 0x69, 0x73,
|
||||
0x2e, 0x45, 0x73, 0x78, 0x69, 0x44, 0x69, 0x73, 0x6b, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x0a, 0x61,
|
||||
0x63, 0x63, 0x65, 0x73, 0x73, 0x49, 0x6e, 0x66, 0x6f, 0x22, 0x43, 0x0a, 0x17, 0x45, 0x73, 0x78,
|
||||
0x69, 0x44, 0x69, 0x73, 0x6b, 0x73, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e,
|
||||
0x49, 0x6e, 0x66, 0x6f, 0x12, 0x28, 0x0a, 0x05, 0x64, 0x69, 0x73, 0x6b, 0x73, 0x18, 0x01, 0x20,
|
||||
0x03, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x61, 0x70, 0x69, 0x73, 0x2e, 0x45, 0x73, 0x78, 0x69, 0x44,
|
||||
0x69, 0x73, 0x6b, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x05, 0x64, 0x69, 0x73, 0x6b, 0x73, 0x32, 0xc6,
|
||||
0x03, 0x0a, 0x0b, 0x44, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x41, 0x67, 0x65, 0x6e, 0x74, 0x12, 0x40,
|
||||
0x0a, 0x0d, 0x44, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x47, 0x75, 0x65, 0x73, 0x74, 0x46, 0x73, 0x12,
|
||||
0x12, 0x2e, 0x61, 0x70, 0x69, 0x73, 0x2e, 0x44, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x50, 0x61, 0x72,
|
||||
0x61, 0x6d, 0x73, 0x1a, 0x1b, 0x2e, 0x61, 0x70, 0x69, 0x73, 0x2e, 0x44, 0x65, 0x70, 0x6c, 0x6f,
|
||||
0x79, 0x47, 0x75, 0x65, 0x73, 0x74, 0x46, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
|
||||
0x12, 0x2d, 0x0a, 0x08, 0x52, 0x65, 0x73, 0x69, 0x7a, 0x65, 0x46, 0x73, 0x12, 0x14, 0x2e, 0x61,
|
||||
0x70, 0x69, 0x73, 0x2e, 0x52, 0x65, 0x73, 0x69, 0x7a, 0x65, 0x46, 0x73, 0x50, 0x61, 0x72, 0x61,
|
||||
0x6d, 0x73, 0x1a, 0x0b, 0x2e, 0x61, 0x70, 0x69, 0x73, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x12,
|
||||
0x2d, 0x0a, 0x08, 0x46, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x46, 0x73, 0x12, 0x14, 0x2e, 0x61, 0x70,
|
||||
0x69, 0x73, 0x2e, 0x46, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x46, 0x73, 0x50, 0x61, 0x72, 0x61, 0x6d,
|
||||
0x73, 0x1a, 0x0b, 0x2e, 0x61, 0x70, 0x69, 0x73, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x12, 0x44,
|
||||
0x0a, 0x0c, 0x53, 0x61, 0x76, 0x65, 0x54, 0x6f, 0x47, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x12, 0x18,
|
||||
0x2e, 0x61, 0x70, 0x69, 0x73, 0x2e, 0x53, 0x61, 0x76, 0x65, 0x54, 0x6f, 0x47, 0x6c, 0x61, 0x6e,
|
||||
0x63, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x1a, 0x1a, 0x2e, 0x61, 0x70, 0x69, 0x73, 0x2e,
|
||||
0x53, 0x61, 0x76, 0x65, 0x54, 0x6f, 0x47, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70,
|
||||
0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3d, 0x0a, 0x0e, 0x50, 0x72, 0x6f, 0x62, 0x65, 0x49, 0x6d, 0x61,
|
||||
0x67, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x1a, 0x2e, 0x61, 0x70, 0x69, 0x73, 0x2e, 0x50, 0x72,
|
||||
0x6f, 0x62, 0x65, 0x49, 0x6d, 0x61, 0x67, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x50, 0x72, 0x61, 0x6d,
|
||||
0x61, 0x73, 0x1a, 0x0f, 0x2e, 0x61, 0x70, 0x69, 0x73, 0x2e, 0x49, 0x6d, 0x61, 0x67, 0x65, 0x49,
|
||||
0x6e, 0x66, 0x6f, 0x12, 0x4f, 0x0a, 0x10, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x45, 0x73,
|
||||
0x78, 0x69, 0x44, 0x69, 0x73, 0x6b, 0x73, 0x12, 0x1c, 0x2e, 0x61, 0x70, 0x69, 0x73, 0x2e, 0x43,
|
||||
0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x45, 0x73, 0x78, 0x69, 0x44, 0x69, 0x73, 0x6b, 0x73, 0x50,
|
||||
0x61, 0x72, 0x61, 0x6d, 0x73, 0x1a, 0x1d, 0x2e, 0x61, 0x70, 0x69, 0x73, 0x2e, 0x45, 0x73, 0x78,
|
||||
0x69, 0x44, 0x69, 0x73, 0x6b, 0x73, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e,
|
||||
0x49, 0x6e, 0x66, 0x6f, 0x12, 0x41, 0x0a, 0x13, 0x44, 0x69, 0x73, 0x63, 0x6f, 0x6e, 0x6e, 0x65,
|
||||
0x63, 0x74, 0x45, 0x73, 0x78, 0x69, 0x44, 0x69, 0x73, 0x6b, 0x73, 0x12, 0x1d, 0x2e, 0x61, 0x70,
|
||||
0x69, 0x73, 0x2e, 0x45, 0x73, 0x78, 0x69, 0x44, 0x69, 0x73, 0x6b, 0x73, 0x43, 0x6f, 0x6e, 0x6e,
|
||||
0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x6e, 0x66, 0x6f, 0x1a, 0x0b, 0x2e, 0x61, 0x70, 0x69,
|
||||
0x73, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x42, 0x34, 0x5a, 0x32, 0x79, 0x75, 0x6e, 0x69, 0x6f,
|
||||
0x6e, 0x2e, 0x69, 0x6f, 0x2f, 0x78, 0x2f, 0x6f, 0x6e, 0x65, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x2f,
|
||||
0x70, 0x6b, 0x67, 0x2f, 0x68, 0x6f, 0x73, 0x74, 0x6d, 0x61, 0x6e, 0x2f, 0x68, 0x6f, 0x73, 0x74,
|
||||
0x64, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x65, 0x72, 0x2f, 0x61, 0x70, 0x69, 0x73, 0x62, 0x06, 0x70,
|
||||
0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
0x72, 0x61, 0x6d, 0x73, 0x1a, 0x1d, 0x2e, 0x61, 0x70, 0x69, 0x73, 0x2e, 0x45, 0x73, 0x78, 0x69,
|
||||
0x44, 0x69, 0x73, 0x6b, 0x73, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x49,
|
||||
0x6e, 0x66, 0x6f, 0x12, 0x41, 0x0a, 0x13, 0x44, 0x69, 0x73, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63,
|
||||
0x74, 0x45, 0x73, 0x78, 0x69, 0x44, 0x69, 0x73, 0x6b, 0x73, 0x12, 0x1d, 0x2e, 0x61, 0x70, 0x69,
|
||||
0x73, 0x2e, 0x45, 0x73, 0x78, 0x69, 0x44, 0x69, 0x73, 0x6b, 0x73, 0x43, 0x6f, 0x6e, 0x6e, 0x65,
|
||||
0x63, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x6e, 0x66, 0x6f, 0x1a, 0x0b, 0x2e, 0x61, 0x70, 0x69, 0x73,
|
||||
0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x42, 0x34, 0x5a, 0x32, 0x79, 0x75, 0x6e, 0x69, 0x6f, 0x6e,
|
||||
0x2e, 0x69, 0x6f, 0x2f, 0x78, 0x2f, 0x6f, 0x6e, 0x65, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x2f, 0x70,
|
||||
0x6b, 0x67, 0x2f, 0x68, 0x6f, 0x73, 0x74, 0x6d, 0x61, 0x6e, 0x2f, 0x68, 0x6f, 0x73, 0x74, 0x64,
|
||||
0x65, 0x70, 0x6c, 0x6f, 0x79, 0x65, 0x72, 0x2f, 0x61, 0x70, 0x69, 0x73, 0x62, 0x06, 0x70, 0x72,
|
||||
0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
|
||||
@@ -67,6 +67,7 @@ message Nic {
|
||||
bool link_up = 24;
|
||||
int64 mtu = 25;
|
||||
string name = 26;
|
||||
bool is_default = 27;
|
||||
}
|
||||
|
||||
message VDDKConInfo {
|
||||
|
||||
@@ -8,7 +8,6 @@ package apis
|
||||
|
||||
import (
|
||||
context "context"
|
||||
|
||||
grpc "google.golang.org/grpc"
|
||||
codes "google.golang.org/grpc/codes"
|
||||
status "google.golang.org/grpc/status"
|
||||
|
||||
@@ -148,6 +148,7 @@ func GuestnetworksDescToDeployDesc(guestnetworks []*desc.SGuestNetwork) []*Nic {
|
||||
nics[i].LinkUp = nic.LinkUp
|
||||
nics[i].Mtu = int64(nic.Mtu)
|
||||
//nics[i].Name = nic.Name
|
||||
nics[i].IsDefault = nic.IsDefault
|
||||
}
|
||||
|
||||
return nics
|
||||
|
||||
@@ -18,6 +18,7 @@ import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"net"
|
||||
"os"
|
||||
"runtime/debug"
|
||||
@@ -27,10 +28,13 @@ import (
|
||||
"google.golang.org/grpc"
|
||||
|
||||
execlient "yunion.io/x/executor/client"
|
||||
"yunion.io/x/jsonutils"
|
||||
"yunion.io/x/log"
|
||||
"yunion.io/x/pkg/errors"
|
||||
|
||||
app_common "yunion.io/x/onecloud/pkg/cloudcommon/app"
|
||||
commonconsts "yunion.io/x/onecloud/pkg/cloudcommon/consts"
|
||||
common_options "yunion.io/x/onecloud/pkg/cloudcommon/options"
|
||||
"yunion.io/x/onecloud/pkg/cloudcommon/service"
|
||||
"yunion.io/x/onecloud/pkg/hostman/diskutils"
|
||||
"yunion.io/x/onecloud/pkg/hostman/diskutils/libguestfs"
|
||||
@@ -325,7 +329,7 @@ func (s *SDeployService) PrepareEnv() error {
|
||||
return err
|
||||
}
|
||||
|
||||
if err := fsdriver.Init(DeployOption.PrivatePrefixes, DeployOption.CloudrootDir); err != nil {
|
||||
if err := fsdriver.Init(DeployOption.CloudrootDir); err != nil {
|
||||
log.Fatalln(err)
|
||||
}
|
||||
if DeployOption.ImageDeployDriver == consts.DEPLOY_DRIVER_LIBGUESTFS {
|
||||
@@ -360,16 +364,16 @@ func (s *SDeployService) PrepareEnv() error {
|
||||
if err != nil {
|
||||
return errors.Wrapf(err, "cp files failed %s", out)
|
||||
}
|
||||
if DeployOption.Config != "" && fileutils2.Exists(DeployOption.Config) {
|
||||
out, err = procutils.NewCommand("cp", "-Lrf", DeployOption.Config, "/opt/yunion/host.conf").Output()
|
||||
|
||||
{
|
||||
newOptions := DeployOption
|
||||
newOptions.CommonConfigFile = ""
|
||||
// save runtime options to /opt/yunion/host.conf
|
||||
conf := jsonutils.Marshal(newOptions).YAMLString()
|
||||
log.Debugf("deploy options: %s", conf)
|
||||
err := ioutil.WriteFile("/opt/yunion/host.conf", []byte(conf), 0600)
|
||||
if err != nil {
|
||||
return errors.Wrapf(err, "cp files failed %s", out)
|
||||
}
|
||||
}
|
||||
if DeployOption.CommonConfigFile != "" && fileutils2.Exists(DeployOption.CommonConfigFile) {
|
||||
out, err = procutils.NewCommand("cp", "-Lrf", DeployOption.CommonConfigFile, "/opt/yunion/common.conf").Output()
|
||||
if err != nil {
|
||||
return errors.Wrapf(err, "cp files failed %s", out)
|
||||
return errors.Wrapf(err, "save host.conf failed %s", out)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -450,6 +454,15 @@ func (s *SDeployService) InitService() {
|
||||
}
|
||||
})
|
||||
|
||||
optionsInit()
|
||||
|
||||
if len(DeployOption.DeployAction) > 0 {
|
||||
if err := LocalInitEnv(); err != nil {
|
||||
log.Fatalf("local init env %s", err)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
if DeployOption.EnableRemoteExecutor {
|
||||
log.Infof("exec socket path: %s", DeployOption.ExecutorSocketPath)
|
||||
execlient.Init(DeployOption.ExecutorSocketPath)
|
||||
@@ -457,12 +470,10 @@ func (s *SDeployService) InitService() {
|
||||
procutils.SetRemoteExecutor()
|
||||
}
|
||||
|
||||
if DeployOption.DeployAction != "" {
|
||||
if err := LocalInitEnv(); err != nil {
|
||||
log.Fatalf("local init env %s", err)
|
||||
}
|
||||
return
|
||||
}
|
||||
app_common.InitAuth(&DeployOption.CommonOptions, func() {
|
||||
log.Infof("Auth complete!!")
|
||||
})
|
||||
common_options.StartOptionManager(&DeployOption.CommonOptions, DeployOption.ConfigSyncPeriodSeconds, "", "", common_options.OnCommonOptionsChange)
|
||||
|
||||
if err := s.PrepareEnv(); err != nil {
|
||||
log.Fatalln(err)
|
||||
|
||||
@@ -22,6 +22,7 @@ import (
|
||||
"github.com/sirupsen/logrus"
|
||||
|
||||
"yunion.io/x/pkg/errors"
|
||||
"yunion.io/x/pkg/util/netutils"
|
||||
|
||||
commonconsts "yunion.io/x/onecloud/pkg/cloudcommon/consts"
|
||||
"yunion.io/x/onecloud/pkg/hostman/diskutils"
|
||||
@@ -111,7 +112,8 @@ func LocalInitEnv() error {
|
||||
return errors.Wrap(err, "set env path")
|
||||
}
|
||||
|
||||
if err := fsdriver.Init(DeployOption.PrivatePrefixes, DeployOption.CloudrootDir); err != nil {
|
||||
netutils.SetPrivatePrefixes(DeployOption.CustomizedPrivatePrefixes)
|
||||
if err := fsdriver.Init(DeployOption.CloudrootDir); err != nil {
|
||||
return errors.Wrap(err, "init fsdriver")
|
||||
}
|
||||
commonconsts.SetAllowVmSELinux(DeployOption.AllowVmSELinux)
|
||||
|
||||
@@ -23,8 +23,8 @@ import (
|
||||
type SDeployOptions struct {
|
||||
common_options.HostCommonOptions
|
||||
|
||||
PrivatePrefixes []string `help:"IPv4 private prefixes"`
|
||||
ChntpwPath string `help:"path to chntpw tool" default:"/usr/local/bin/chntpw.static"`
|
||||
// PrivatePrefixes []string `help:"IPv4 private prefixes"`
|
||||
ChntpwPath string `help:"path to chntpw tool" default:"/usr/local/bin/chntpw.static"`
|
||||
|
||||
CloudrootDir string `help:"User cloudroot home dir" default:"/opt"`
|
||||
CommonConfigFile string `help:"common config file for container"`
|
||||
@@ -46,8 +46,9 @@ type SDeployOptions struct {
|
||||
|
||||
var DeployOption SDeployOptions
|
||||
|
||||
func Parse() (hostOpts SDeployOptions) {
|
||||
common_options.ParseOptionsIgnoreNoConfigfile(&hostOpts, os.Args, "host.conf", "host")
|
||||
func Parse() SDeployOptions {
|
||||
var hostOpts SDeployOptions
|
||||
common_options.ParseOptions(&hostOpts, os.Args, "host.conf", "host")
|
||||
if len(hostOpts.CommonConfigFile) > 0 {
|
||||
commonCfg := &common_options.HostCommonOptions{}
|
||||
commonCfg.Config = hostOpts.CommonConfigFile
|
||||
@@ -60,6 +61,6 @@ func Parse() (hostOpts SDeployOptions) {
|
||||
return hostOpts
|
||||
}
|
||||
|
||||
func init() {
|
||||
func optionsInit() {
|
||||
DeployOption = Parse()
|
||||
}
|
||||
|
||||
@@ -21,7 +21,6 @@ import (
|
||||
"time"
|
||||
|
||||
"yunion.io/x/log"
|
||||
"yunion.io/x/pkg/errors"
|
||||
"yunion.io/x/pkg/util/netutils"
|
||||
|
||||
"yunion.io/x/onecloud/pkg/cloudcommon/types"
|
||||
@@ -121,47 +120,19 @@ func gusetnetworkJsonDescToServerNic(nicdesc *types.SServerNic, guestNic *desc.S
|
||||
nicdesc.NicType = guestNic.NicType
|
||||
nicdesc.LinkUp = guestNic.LinkUp
|
||||
nicdesc.TeamWith = guestNic.TeamWith
|
||||
|
||||
nicdesc.IsDefault = guestNic.IsDefault
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func GetMainNic(nics []*desc.SGuestNetwork) (*desc.SGuestNetwork, error) {
|
||||
var mainIp netutils.IPV4Addr
|
||||
var mainNic *desc.SGuestNetwork
|
||||
func GetMainNic(nics []*desc.SGuestNetwork) *desc.SGuestNetwork {
|
||||
for _, n := range nics {
|
||||
if n.Gateway != "" {
|
||||
ipInt, err := netutils.NewIPV4Addr(n.Ip)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if mainIp == 0 {
|
||||
mainIp = ipInt
|
||||
mainNic = n
|
||||
} else if !netutils.IsPrivate(ipInt) && netutils.IsPrivate(mainIp) {
|
||||
mainIp = ipInt
|
||||
mainNic = n
|
||||
}
|
||||
if n.IsDefault {
|
||||
return n
|
||||
}
|
||||
}
|
||||
if mainNic != nil {
|
||||
return mainNic, nil
|
||||
}
|
||||
for _, n := range nics {
|
||||
ipInt, err := netutils.NewIPV4Addr(n.Ip)
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(err, "netutils.NewIPV4Addr %s", n.Ip)
|
||||
}
|
||||
if mainIp == 0 {
|
||||
mainIp = ipInt
|
||||
mainNic = n
|
||||
} else if !netutils.IsPrivate(ipInt) && netutils.IsPrivate(mainIp) {
|
||||
mainIp = ipInt
|
||||
mainNic = n
|
||||
}
|
||||
}
|
||||
if mainNic != nil {
|
||||
return mainNic, nil
|
||||
}
|
||||
return nil, errors.Wrap(errors.ErrInvalidStatus, "no valid nic")
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *SGuestDHCPServer) getGuestConfig(
|
||||
@@ -192,15 +163,14 @@ func (s *SGuestDHCPServer) getGuestConfig(
|
||||
|
||||
// get main ip
|
||||
guestNics := guestDesc.Nics
|
||||
manNic, err := GetMainNic(guestNics)
|
||||
if err != nil {
|
||||
log.Errorln(err)
|
||||
return nil
|
||||
manNic := GetMainNic(guestNics)
|
||||
var mainIp string
|
||||
if manNic != nil {
|
||||
mainIp = manNic.Ip
|
||||
}
|
||||
mainIp := manNic.Ip
|
||||
|
||||
var route = [][]string{}
|
||||
if len(nicdesc.Gateway) > 0 && mainIp == nicIp {
|
||||
if nicdesc.IsDefault {
|
||||
conf.Gateway = net.ParseIP(nicdesc.Gateway)
|
||||
|
||||
osName := guestDesc.OsName
|
||||
@@ -212,8 +182,7 @@ func (s *SGuestDHCPServer) getGuestConfig(
|
||||
}
|
||||
route = append(route, []string{"169.254.169.254/32", nicdesc.Gateway})
|
||||
}
|
||||
netutils2.AddNicRoutes(
|
||||
&route, nicdesc, mainIp, len(guestNics), options.HostOptions.PrivatePrefixes)
|
||||
route = netutils2.AddNicRoutes(route, nicdesc, mainIp, len(guestNics))
|
||||
conf.Routes = route
|
||||
|
||||
if len(nicdesc.Dns) > 0 {
|
||||
|
||||
@@ -100,7 +100,7 @@ type SHostOptions struct {
|
||||
HugepagesOption string `help:"Hugepages option: disable|native|transparent" default:"transparent"`
|
||||
HugepageSizeMb int `help:"hugepage size mb default 1G" default:"1024"`
|
||||
|
||||
PrivatePrefixes []string `help:"IPv4 private prefixes"`
|
||||
// PrivatePrefixes []string `help:"IPv4 private prefixes"`
|
||||
LocalImagePath []string `help:"Local image storage paths"`
|
||||
SharedStorages []string `help:"Path of shared storages"`
|
||||
LVMVolumeGroups []string `help:"LVM Volume Groups(vgs)"`
|
||||
@@ -209,7 +209,8 @@ var (
|
||||
HostOptions SHostOptions
|
||||
)
|
||||
|
||||
func Parse() (hostOpts SHostOptions) {
|
||||
func Parse() SHostOptions {
|
||||
var hostOpts SHostOptions
|
||||
common_options.ParseOptions(&hostOpts, os.Args, "host.conf", "host")
|
||||
if len(hostOpts.CommonConfigFile) > 0 && fileutils2.Exists(hostOpts.CommonConfigFile) {
|
||||
commonCfg := &SHostBaseOptions{}
|
||||
@@ -231,6 +232,7 @@ func Parse() (hostOpts SHostOptions) {
|
||||
log.Fatalf("Parse local configuration file: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
return hostOpts
|
||||
}
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ func init() {
|
||||
[]string{"Guest_ID", "Guest",
|
||||
"Network_ID", "Network", "Mac_addr", "Mapped_Ip_Addr",
|
||||
"IP_addr", "Driver", "BW_limit", "Index",
|
||||
"Virtual", "Ifname", "team_with"},
|
||||
"Virtual", "Ifname", "team_with", "is_default"},
|
||||
[]string{},
|
||||
&Servers,
|
||||
&Networks)
|
||||
|
||||
@@ -15,15 +15,56 @@
|
||||
package identity
|
||||
|
||||
import (
|
||||
"yunion.io/x/jsonutils"
|
||||
"yunion.io/x/pkg/errors"
|
||||
|
||||
identity_api "yunion.io/x/onecloud/pkg/apis/identity"
|
||||
"yunion.io/x/onecloud/pkg/httperrors"
|
||||
"yunion.io/x/onecloud/pkg/mcclient"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/modulebase"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/modules"
|
||||
)
|
||||
|
||||
type SServiceManager struct {
|
||||
modulebase.ResourceManager
|
||||
}
|
||||
|
||||
var (
|
||||
Services modulebase.ResourceManager
|
||||
ServicesV3 modulebase.ResourceManager
|
||||
ServicesV3 SServiceManager
|
||||
)
|
||||
|
||||
func (manager *SServiceManager) GetConfig(s *mcclient.ClientSession, typeStr string) (*jsonutils.JSONDict, error) {
|
||||
opts := struct {
|
||||
Type string
|
||||
Scope string
|
||||
}{
|
||||
Type: s.GetServiceName(typeStr),
|
||||
Scope: "system",
|
||||
}
|
||||
list, err := manager.List(s, jsonutils.Marshal(opts))
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "List")
|
||||
}
|
||||
if len(list.Data) == 0 {
|
||||
return nil, errors.Wrapf(httperrors.ErrNotFound, "type %s not found", typeStr)
|
||||
}
|
||||
srv := identity_api.SService{}
|
||||
err = list.Data[0].Unmarshal(&srv)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "Unmarshal service")
|
||||
}
|
||||
|
||||
configObj, err := manager.GetSpecific(s, srv.Id, "config", nil)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "GetSpecific config")
|
||||
}
|
||||
if configObj.Contains("config") {
|
||||
configObj, _ = configObj.Get("config")
|
||||
}
|
||||
return configObj.(*jsonutils.JSONDict), nil
|
||||
}
|
||||
|
||||
func init() {
|
||||
Services = modules.NewIdentityManager("OS-KSADM:service",
|
||||
"OS-KSADM:services",
|
||||
@@ -32,10 +73,11 @@ func init() {
|
||||
|
||||
modules.Register(&Services)
|
||||
|
||||
ServicesV3 = modules.NewIdentityV3Manager("service",
|
||||
"services",
|
||||
[]string{},
|
||||
[]string{"ID", "Name", "Type", "Description"})
|
||||
|
||||
ServicesV3 = SServiceManager{
|
||||
ResourceManager: modules.NewIdentityV3Manager("service",
|
||||
"services",
|
||||
[]string{},
|
||||
[]string{"ID", "Name", "Type", "Description"}),
|
||||
}
|
||||
modules.Register(&ServicesV3)
|
||||
}
|
||||
|
||||
@@ -121,7 +121,7 @@ func getApiVersionByServiceType(serviceType string) string {
|
||||
return ""
|
||||
}
|
||||
|
||||
func (this *ClientSession) getServiceName(service string) string {
|
||||
func (this *ClientSession) GetServiceName(service string) string {
|
||||
apiVersion := getApiVersionByServiceType(service)
|
||||
if len(apiVersion) > 0 && apiVersion != DEFAULT_API_VERSION {
|
||||
service = fmt.Sprintf("%s_%s", service, apiVersion)
|
||||
@@ -161,7 +161,7 @@ func (this *ClientSession) GetServiceVersionURLs(service, endpointType string) (
|
||||
// session specific endpoint type should override the input endpointType, which is supplied by manager
|
||||
endpointType = this.endpointType
|
||||
}
|
||||
service = this.getServiceName(service)
|
||||
service = this.GetServiceName(service)
|
||||
if endpointType == api.EndpointInterfaceApigateway {
|
||||
return this.getApigatewayServiceURLs(service, this.region, this.zone, endpointType)
|
||||
} else {
|
||||
|
||||
@@ -0,0 +1,74 @@
|
||||
// Copyright 2019 Yunion
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package netutils2
|
||||
|
||||
import (
|
||||
"yunion.io/x/log"
|
||||
"yunion.io/x/pkg/util/netutils"
|
||||
)
|
||||
|
||||
type SNicInfo struct {
|
||||
IpAddr string
|
||||
Gateway string
|
||||
MacAddr string
|
||||
}
|
||||
|
||||
type SNicInfoList []SNicInfo
|
||||
|
||||
func (nics SNicInfoList) Add(ip, mac, gw string) SNicInfoList {
|
||||
return append(nics, SNicInfo{
|
||||
IpAddr: ip,
|
||||
MacAddr: mac,
|
||||
Gateway: gw,
|
||||
})
|
||||
}
|
||||
|
||||
func (nics SNicInfoList) FindDefaultNicMac() (string, int) {
|
||||
var intMac, exitMac string
|
||||
var intIdx, exitIdx int
|
||||
for i, nic := range nics {
|
||||
if len(nic.IpAddr) == 0 {
|
||||
continue
|
||||
}
|
||||
if len(nic.Gateway) == 0 {
|
||||
continue
|
||||
}
|
||||
addr, err := netutils.NewIPV4Addr(nic.IpAddr)
|
||||
if err != nil {
|
||||
log.Errorf("NewIPV4Addr %s fail %s", nic.IpAddr, err)
|
||||
continue
|
||||
}
|
||||
if len(exitMac) == 0 || len(intMac) == 0 {
|
||||
isExit := netutils.IsExitAddress(addr)
|
||||
if len(exitMac) == 0 && isExit {
|
||||
exitMac = nic.MacAddr
|
||||
exitIdx = i
|
||||
}
|
||||
if len(intMac) == 0 && !isExit {
|
||||
intMac = nic.MacAddr
|
||||
intIdx = i
|
||||
}
|
||||
} else if len(exitMac) > 0 && len(intMac) > 0 {
|
||||
break
|
||||
}
|
||||
}
|
||||
if len(exitMac) > 0 {
|
||||
return exitMac, exitIdx
|
||||
}
|
||||
if len(intMac) > 0 {
|
||||
return intMac, intIdx
|
||||
}
|
||||
return "", -1
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
// Copyright 2019 Yunion
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package netutils2
|
||||
|
||||
import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestFindDefaultNic(t *testing.T) {
|
||||
cases := []struct {
|
||||
nics [][]string
|
||||
mac string
|
||||
index int
|
||||
}{
|
||||
{
|
||||
nics: [][]string{
|
||||
{"192.168.202.147", "00:22:00:00:00:01", "192.168.202.1"},
|
||||
},
|
||||
mac: "00:22:00:00:00:01",
|
||||
index: 0,
|
||||
},
|
||||
{
|
||||
nics: [][]string{
|
||||
{"192.168.202.147", "00:22:00:00:00:01", "192.168.202.1"},
|
||||
{"192.168.203.147", "00:22:00:00:00:02", "192.168.203.1"},
|
||||
},
|
||||
mac: "00:22:00:00:00:01",
|
||||
index: 0,
|
||||
},
|
||||
{
|
||||
nics: [][]string{
|
||||
{"192.168.202.147", "00:22:00:00:00:01", "192.168.202.1"},
|
||||
{"202.168.202.147", "00:22:00:00:00:02", "202.168.202.1"},
|
||||
},
|
||||
mac: "00:22:00:00:00:02",
|
||||
index: 1,
|
||||
},
|
||||
{
|
||||
nics: [][]string{
|
||||
{"202.168.202.147", "00:22:00:00:00:01", "202.168.202.1"},
|
||||
{"192.168.202.147", "00:22:00:00:00:02", "192.168.202.1"},
|
||||
},
|
||||
mac: "00:22:00:00:00:01",
|
||||
index: 0,
|
||||
},
|
||||
{
|
||||
nics: [][]string{
|
||||
{"192.168.202.147", "00:22:00:00:00:01", "192.168.202.1"},
|
||||
{"", "00:22:00:00:00:02", ""},
|
||||
{"202.168.202.147", "00:22:00:00:00:03", "202.168.202.1"},
|
||||
},
|
||||
mac: "00:22:00:00:00:03",
|
||||
index: 2,
|
||||
},
|
||||
}
|
||||
for _, c := range cases {
|
||||
nics := SNicInfoList{}
|
||||
for _, n := range c.nics {
|
||||
nics = nics.Add(n[0], n[1], n[2])
|
||||
}
|
||||
|
||||
gotMac, gotIdx := nics.FindDefaultNicMac()
|
||||
if gotMac != c.mac || gotIdx != c.index {
|
||||
t.Errorf("want %s (%d) got %s (%d)", c.mac, c.index, gotMac, gotIdx)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -130,42 +130,44 @@ func Netlen2Mask(netmasklen int) string {
|
||||
return netutils.Netlen2Mask(netmasklen)
|
||||
}
|
||||
|
||||
func addRoute(routes *[][]string, net, gw string) {
|
||||
for _, rt := range *routes {
|
||||
func addRoute(routes [][]string, net, gw string) [][]string {
|
||||
for _, rt := range routes {
|
||||
if rt[0] == net {
|
||||
return
|
||||
return routes
|
||||
}
|
||||
}
|
||||
*routes = append(*routes, []string{net, gw})
|
||||
return append(routes, []string{net, gw})
|
||||
}
|
||||
|
||||
func extendRoutes(routes *[][]string, nicRoutes []types.SRoute) error {
|
||||
func extendRoutes(routes [][]string, nicRoutes []types.SRoute) [][]string {
|
||||
for i := 0; i < len(nicRoutes); i++ {
|
||||
addRoute(routes, nicRoutes[i][0], nicRoutes[i][1])
|
||||
routes = addRoute(routes, nicRoutes[i][0], nicRoutes[i][1])
|
||||
}
|
||||
return nil
|
||||
return routes
|
||||
}
|
||||
|
||||
func isExitAddress(ip string) bool {
|
||||
ipv4, err := netutils.NewIPV4Addr(ip)
|
||||
if err != nil {
|
||||
log.Errorf("NewIPV4Addr %s fail %s", ip, err)
|
||||
return false
|
||||
}
|
||||
return !netutils.IsPrivate(ipv4) || netutils.IsHostLocal(ipv4) || netutils.IsLinkLocal(ipv4)
|
||||
return netutils.IsExitAddress(ipv4)
|
||||
}
|
||||
|
||||
func AddNicRoutes(routes *[][]string, nicDesc *types.SServerNic, mainIp string, nicCnt int, privatePrefixes []string) {
|
||||
func AddNicRoutes(routes [][]string, nicDesc *types.SServerNic, mainIp string, nicCnt int) [][]string {
|
||||
if mainIp == nicDesc.Ip {
|
||||
return
|
||||
return routes
|
||||
}
|
||||
if len(nicDesc.Routes) > 0 {
|
||||
extendRoutes(routes, nicDesc.Routes)
|
||||
routes = extendRoutes(routes, nicDesc.Routes)
|
||||
} else if len(nicDesc.Gateway) > 0 && !isExitAddress(nicDesc.Ip) &&
|
||||
nicCnt == 2 && nicDesc.Ip != mainIp && isExitAddress(mainIp) {
|
||||
for _, pref := range GetPrivatePrefixes(privatePrefixes) {
|
||||
addRoute(routes, pref, nicDesc.Gateway)
|
||||
for _, pref := range netutils.GetPrivateIPRanges() {
|
||||
routes = addRoute(routes, pref.String(), nicDesc.Gateway)
|
||||
}
|
||||
}
|
||||
return routes
|
||||
}
|
||||
|
||||
func GetNicDns(nicdesc *types.SServerNic) []string {
|
||||
|
||||
@@ -79,7 +79,7 @@ func TestFormatMac(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestNewNetInterface(t *testing.T) {
|
||||
n := NewNetInterface("br0")
|
||||
n := NewNetInterface("eth0")
|
||||
t.Logf("NetInterface: %s %s %s %s", n.name, n.Addr, n.Mask.String(), n.mac)
|
||||
}
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@ import (
|
||||
"yunion.io/x/log"
|
||||
|
||||
compute_models "yunion.io/x/onecloud/pkg/compute/models"
|
||||
"yunion.io/x/onecloud/pkg/util/netutils2"
|
||||
)
|
||||
|
||||
type Vpc struct {
|
||||
@@ -135,6 +136,42 @@ func (el *Guest) GetVips() []string {
|
||||
return ret
|
||||
}
|
||||
|
||||
type GuestnetworkList []*Guestnetwork
|
||||
|
||||
func (a GuestnetworkList) Len() int { return len(a) }
|
||||
func (a GuestnetworkList) Swap(i, j int) { a[i], a[j] = a[j], a[i] }
|
||||
func (a GuestnetworkList) Less(i, j int) bool { return a[i].Index < a[j].Index }
|
||||
|
||||
func (el *Guest) FixIsDefaults() {
|
||||
gns := make([]*Guestnetwork, 0, len(el.Guestnetworks))
|
||||
for _, v := range el.Guestnetworks {
|
||||
gns = append(gns, v)
|
||||
}
|
||||
sort.Sort(GuestnetworkList(gns))
|
||||
defaultCnt := 0
|
||||
nics := netutils2.SNicInfoList{}
|
||||
for _, gn := range gns {
|
||||
if gn.Network == nil {
|
||||
log.Debugf("guest %s %s", gn.GuestId, gn.NetworkId)
|
||||
continue
|
||||
}
|
||||
if gn.IsDefault {
|
||||
defaultCnt++
|
||||
}
|
||||
nics = nics.Add(gn.IpAddr, gn.MacAddr, gn.Network.GuestGateway)
|
||||
}
|
||||
if defaultCnt != 1 {
|
||||
gwMac, _ := nics.FindDefaultNicMac()
|
||||
for _, gn := range gns {
|
||||
if gn.MacAddr == gwMac {
|
||||
gn.IsDefault = true
|
||||
} else {
|
||||
gn.IsDefault = false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
type Host struct {
|
||||
compute_models.SHost
|
||||
}
|
||||
|
||||
@@ -81,6 +81,12 @@ func (set Vpcs) Copy() apihelper.IModelSet {
|
||||
return setCopy
|
||||
}
|
||||
|
||||
func (set Vpcs) ModelParamFilter() jsonutils.JSONObject {
|
||||
params := jsonutils.NewDict()
|
||||
params.Add(jsonutils.NewString("OneCloud"), "provider")
|
||||
return params
|
||||
}
|
||||
|
||||
func (ms Vpcs) joinWires(subEntries Wires) bool {
|
||||
correct := true
|
||||
for _, subEntry := range subEntries {
|
||||
@@ -230,6 +236,12 @@ func (set Guests) Copy() apihelper.IModelSet {
|
||||
return setCopy
|
||||
}
|
||||
|
||||
func (set Guests) ModelParamFilter() jsonutils.JSONObject {
|
||||
params := jsonutils.NewDict()
|
||||
params.Add(jsonutils.NewString("OneCloud"), "provider")
|
||||
return params
|
||||
}
|
||||
|
||||
func (set Guests) initJoin() {
|
||||
for _, el := range set {
|
||||
el.SecurityGroups = SecurityGroups{}
|
||||
@@ -339,6 +351,12 @@ func (set Hosts) Copy() apihelper.IModelSet {
|
||||
return setCopy
|
||||
}
|
||||
|
||||
func (set Hosts) ModelParamFilter() jsonutils.JSONObject {
|
||||
params := jsonutils.NewDict()
|
||||
params.Add(jsonutils.NewString("OneCloud"), "provider")
|
||||
return params
|
||||
}
|
||||
|
||||
func (set Networks) ModelManager() mcclient_modulebase.IBaseManager {
|
||||
return &mcclient_modules.Networks
|
||||
}
|
||||
|
||||
@@ -301,6 +301,10 @@ func (mss *ModelSets) join() bool {
|
||||
}
|
||||
if !ret {
|
||||
log.Errorln(strings.Join(failMsg, ","))
|
||||
} else {
|
||||
for _, g := range mss.Guests {
|
||||
g.FixIsDefaults()
|
||||
}
|
||||
}
|
||||
return ret
|
||||
}
|
||||
|
||||
@@ -43,6 +43,12 @@ type VpcAgentOptions struct {
|
||||
OvnWorkerCheckInterval int `default:"180"`
|
||||
OvnNorthDatabase string `help:"address for accessing ovn north database. Default to local unix socket"`
|
||||
OvnUnderlayMtu int `help:"mtu of ovn underlay network" default:"1500"`
|
||||
|
||||
DhcpLeaseTime int `default:"100663296" help:"DHCP lease time in seconds"`
|
||||
DhcpRenewalTime int `default:"67108864" help:"DHCP renewal time in seconds"`
|
||||
|
||||
DNSServer string `help:"Address of DNS server"`
|
||||
DNSDomain string `help:"Domain suffix for virtual servers"`
|
||||
}
|
||||
|
||||
type Options struct {
|
||||
@@ -79,3 +85,19 @@ func (opts *Options) ValidateThenInit() error {
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func OnOptionsChange(oldO, newO interface{}) bool {
|
||||
oldOpts := oldO.(*Options)
|
||||
newOpts := newO.(*Options)
|
||||
|
||||
changed := false
|
||||
if common_options.OnCommonOptionsChange(&oldOpts.CommonOptions, &newOpts.CommonOptions) {
|
||||
changed = true
|
||||
}
|
||||
|
||||
if oldOpts.VpcProvider != newOpts.VpcProvider {
|
||||
changed = true
|
||||
}
|
||||
|
||||
return changed
|
||||
}
|
||||
|
||||
+125
-21
@@ -260,11 +260,10 @@ func (keeper *OVNNorthboundKeeper) ClaimVpc(ctx context.Context, vpc *agentmodel
|
||||
|
||||
func (keeper *OVNNorthboundKeeper) ClaimNetwork(ctx context.Context, network *agentmodels.Network, opts *options.Options) error {
|
||||
var (
|
||||
vpc = network.Vpc
|
||||
rpMac = mac.HashSubnetRouterPortMac(network.Id)
|
||||
dhcpMac = mac.HashSubnetDhcpMac(network.Id)
|
||||
mdMac = mac.HashSubnetMetadataMac(network.Id)
|
||||
mdIp = "169.254.169.254"
|
||||
vpc = network.Vpc
|
||||
rpMac = mac.HashSubnetRouterPortMac(network.Id)
|
||||
mdMac = mac.HashSubnetMetadataMac(network.Id)
|
||||
mdIp = "169.254.169.254"
|
||||
)
|
||||
netLs := &ovn_nb.LogicalSwitch{
|
||||
Name: netLsName(network.Id),
|
||||
@@ -301,7 +300,7 @@ func (keeper *OVNNorthboundKeeper) ClaimNetwork(ctx context.Context, network *ag
|
||||
OutputPort: ptr(vpcR2extpName(vpc.Id)),
|
||||
}
|
||||
|
||||
routes := []string{
|
||||
/*routes := []string{
|
||||
mdIp, "0.0.0.0",
|
||||
"0.0.0.0/0", network.GuestGateway,
|
||||
}
|
||||
@@ -359,10 +358,10 @@ func (keeper *OVNNorthboundKeeper) ClaimNetwork(ctx context.Context, network *ag
|
||||
}
|
||||
}
|
||||
if len(ntpSrvs) > 0 {
|
||||
// bug on OVN, should not use ntp server
|
||||
// bug on OVN, should not use ntp server: QiuJian
|
||||
// dhcpopts.Options["ntp_server"] = "{" + ntpSrvs + "}"
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
var (
|
||||
args []string
|
||||
@@ -373,7 +372,7 @@ func (keeper *OVNNorthboundKeeper) ClaimNetwork(ctx context.Context, network *ag
|
||||
netRnp,
|
||||
netNrp,
|
||||
netMdp,
|
||||
dhcpopts,
|
||||
// dhcpopts,
|
||||
vpcExtBackRoute,
|
||||
)
|
||||
if allFound {
|
||||
@@ -383,7 +382,7 @@ func (keeper *OVNNorthboundKeeper) ClaimNetwork(ctx context.Context, network *ag
|
||||
args = append(args, ovnCreateArgs(netRnp, netRnp.Name)...)
|
||||
args = append(args, ovnCreateArgs(netNrp, netNrp.Name)...)
|
||||
args = append(args, ovnCreateArgs(netMdp, netMdp.Name)...)
|
||||
args = append(args, ovnCreateArgs(dhcpopts, "dhcpopts")...)
|
||||
// args = append(args, ovnCreateArgs(dhcpopts, "dhcpopts")...)
|
||||
args = append(args, ovnCreateArgs(vpcExtBackRoute, "vpcExtBackRoute")...)
|
||||
args = append(args, "--", "add", "Logical_Switch", netLs.Name, "ports", "@"+netNrp.Name, "@"+netMdp.Name)
|
||||
args = append(args, "--", "add", "Logical_Router", vpcLrName(vpc.Id), "ports", "@"+netRnp.Name)
|
||||
@@ -448,7 +447,104 @@ func (keeper *OVNNorthboundKeeper) ClaimVpcEipgw(ctx context.Context, vpc *agent
|
||||
return keeper.cli.Must(ctx, "ClaimVpcEipgw", args)
|
||||
}
|
||||
|
||||
func (keeper *OVNNorthboundKeeper) ClaimGuestnetwork(ctx context.Context, guestnetwork *agentmodels.Guestnetwork) error {
|
||||
func generateDhcpOptions(ctx context.Context, guestnetwork *agentmodels.Guestnetwork, opts *options.Options) *ovn_nb.DHCPOptions {
|
||||
var (
|
||||
network = guestnetwork.Network
|
||||
dhcpMac = mac.HashSubnetDhcpMac(network.Id)
|
||||
mdIp = "169.254.169.254"
|
||||
|
||||
ocDhcpRef = fmt.Sprintf("dhcp/%s/%s", guestnetwork.GuestId, guestnetwork.Ifname)
|
||||
)
|
||||
|
||||
mtu := opts.OvnUnderlayMtu
|
||||
mtu -= apis.VPC_OVN_ENCAP_COST
|
||||
var (
|
||||
leaseTime = opts.DhcpLeaseTime
|
||||
renewTime = opts.DhcpRenewalTime
|
||||
rebindTime = opts.DhcpRenewalTime / 2
|
||||
)
|
||||
guestStartIp, _ := netutils.NewIPV4Addr(network.GuestIpStart)
|
||||
cidr := fmt.Sprintf("%s/%d", guestStartIp.NetAddr(network.GuestIpMask).String(), network.GuestIpMask)
|
||||
dhcpopts := &ovn_nb.DHCPOptions{
|
||||
Cidr: cidr,
|
||||
Options: map[string]string{
|
||||
"server_id": network.GuestGateway,
|
||||
"server_mac": dhcpMac,
|
||||
"router": network.GuestGateway,
|
||||
"mtu": fmt.Sprintf("%d", mtu),
|
||||
"lease_time": fmt.Sprintf("%d", leaseTime),
|
||||
"T1": fmt.Sprintf("%d", renewTime),
|
||||
"T2": fmt.Sprintf("%d", rebindTime),
|
||||
},
|
||||
ExternalIds: map[string]string{
|
||||
externalKeyOcRef: ocDhcpRef,
|
||||
},
|
||||
}
|
||||
{
|
||||
routes := []string{}
|
||||
if guestnetwork.IsDefault {
|
||||
routes = append(routes,
|
||||
mdIp, "0.0.0.0",
|
||||
"0.0.0.0/0", network.GuestGateway,
|
||||
)
|
||||
} else {
|
||||
routes = append(routes,
|
||||
cidr, "0.0.0.0",
|
||||
)
|
||||
}
|
||||
if len(routes) > 0 {
|
||||
dhcpopts.Options["classless_static_route"] = fmt.Sprintf("{%s}", strings.Join(routes, ","))
|
||||
}
|
||||
}
|
||||
{
|
||||
dnsSrvs := network.GuestDns
|
||||
if dnsSrvs == "" {
|
||||
dns, err := auth.GetDNSServers(opts.Region, "")
|
||||
if err != nil {
|
||||
// ignore the error
|
||||
// log.Errorf("auth.GetDNSServers fail %s", err)
|
||||
} else {
|
||||
dnsSrvs = strings.Join(dns, ",")
|
||||
}
|
||||
}
|
||||
if dnsSrvs == "" {
|
||||
dnsSrvs = opts.DNSServer
|
||||
}
|
||||
if len(dnsSrvs) > 0 {
|
||||
dhcpopts.Options["dns_server"] = "{" + dnsSrvs + "}"
|
||||
}
|
||||
}
|
||||
{
|
||||
dnsDomain := network.GuestDomain
|
||||
if dnsDomain == "" {
|
||||
dnsDomain = opts.DNSDomain
|
||||
}
|
||||
if len(dnsDomain) > 0 {
|
||||
dhcpopts.Options["domain_name"] = dnsDomain
|
||||
}
|
||||
}
|
||||
{
|
||||
ntpSrvs := ""
|
||||
if network.GuestNtp != "" {
|
||||
ntpSrvs = network.GuestNtp
|
||||
} else {
|
||||
ntp, err := auth.GetNTPServers(opts.Region, "")
|
||||
if err != nil {
|
||||
// ignore
|
||||
// log.Errorf("auth.GetNTPServers fail %s", err)
|
||||
} else {
|
||||
ntpSrvs = strings.Join(ntp, ",")
|
||||
}
|
||||
}
|
||||
if len(ntpSrvs) > 0 {
|
||||
// bug on OVN, should not use ntp server: QiuJian
|
||||
// dhcpopts.Options["ntp_server"] = "{" + ntpSrvs + "}"
|
||||
}
|
||||
}
|
||||
return dhcpopts
|
||||
}
|
||||
|
||||
func (keeper *OVNNorthboundKeeper) ClaimGuestnetwork(ctx context.Context, guestnetwork *agentmodels.Guestnetwork, opts *options.Options) error {
|
||||
var (
|
||||
// Callers assure that guestnetwork.Guest is not nil
|
||||
guest = guestnetwork.Guest
|
||||
@@ -463,10 +559,10 @@ func (keeper *OVNNorthboundKeeper) ClaimGuestnetwork(ctx context.Context, guestn
|
||||
ocAclRef = fmt.Sprintf("acl/%s/%s/%s", network.Id, guestnetwork.GuestId, guestnetwork.Ifname)
|
||||
ocQosRef = fmt.Sprintf("qos/%s/%s/%s", network.Id, guestnetwork.GuestId, guestnetwork.Ifname)
|
||||
ocQosEipRef = fmt.Sprintf("qos-eip/%s/%s/%s/v2", vpc.Id, guestnetwork.GuestId, guestnetwork.Ifname)
|
||||
dhcpOpt string
|
||||
// dhcpOpt string
|
||||
)
|
||||
|
||||
{
|
||||
/*{
|
||||
dhcpOptQuery := &ovn_nb.DHCPOptions{
|
||||
ExternalIds: map[string]string{
|
||||
externalKeyOcRef: guestnetwork.NetworkId,
|
||||
@@ -485,7 +581,7 @@ func (keeper *OVNNorthboundKeeper) ClaimGuestnetwork(ctx context.Context, guestn
|
||||
if dhcpOpt == "" {
|
||||
return fmt.Errorf("cannot find dhcpopt for subnet %s", guestnetwork.NetworkId)
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
var (
|
||||
subIPs = []string{guestnetwork.IpAddr}
|
||||
@@ -499,10 +595,10 @@ func (keeper *OVNNorthboundKeeper) ClaimGuestnetwork(ctx context.Context, guestn
|
||||
sort.Strings(subIPs[1:])
|
||||
sort.Strings(subIPms[1:])
|
||||
gnp := &ovn_nb.LogicalSwitchPort{
|
||||
Name: lportName,
|
||||
Addresses: []string{fmt.Sprintf("%s %s", guestnetwork.MacAddr, strings.Join(subIPs, " "))},
|
||||
Dhcpv4Options: &dhcpOpt,
|
||||
Options: map[string]string{},
|
||||
Name: lportName,
|
||||
Addresses: []string{fmt.Sprintf("%s %s", guestnetwork.MacAddr, strings.Join(subIPs, " "))},
|
||||
// Dhcpv4Options: &dhcpOpt,
|
||||
Options: map[string]string{},
|
||||
}
|
||||
if guest.SrcMacCheck.IsFalse() {
|
||||
gnp.Addresses = append(gnp.Addresses, "unknown")
|
||||
@@ -510,7 +606,7 @@ func (keeper *OVNNorthboundKeeper) ClaimGuestnetwork(ctx context.Context, guestn
|
||||
gnp.PortSecurity = []string{}
|
||||
} else if guest.SrcIpCheck.IsFalse() {
|
||||
gnp.PortSecurity = []string{
|
||||
fmt.Sprintf("%s", guestnetwork.MacAddr),
|
||||
guestnetwork.MacAddr,
|
||||
}
|
||||
} else {
|
||||
gnp.PortSecurity = []string{
|
||||
@@ -521,6 +617,11 @@ func (keeper *OVNNorthboundKeeper) ClaimGuestnetwork(ctx context.Context, guestn
|
||||
}
|
||||
}
|
||||
|
||||
var (
|
||||
dhcpOpt = generateDhcpOptions(ctx, guestnetwork, opts)
|
||||
dhcpOptName = fmt.Sprintf("dhcp-opt-%s-%s", guestnetwork.GuestId, guestnetwork.Ifname)
|
||||
)
|
||||
|
||||
var qosVif []*ovn_nb.QoS
|
||||
if bwMbps := guestnetwork.BwLimit; bwMbps > 0 {
|
||||
var (
|
||||
@@ -528,7 +629,7 @@ func (keeper *OVNNorthboundKeeper) ClaimGuestnetwork(ctx context.Context, guestn
|
||||
kbur = int64(kbps * 2)
|
||||
)
|
||||
qosVif = []*ovn_nb.QoS{
|
||||
&ovn_nb.QoS{
|
||||
{
|
||||
Priority: 2000,
|
||||
Direction: "from-lport",
|
||||
Match: fmt.Sprintf("inport == %q", lportName),
|
||||
@@ -540,7 +641,7 @@ func (keeper *OVNNorthboundKeeper) ClaimGuestnetwork(ctx context.Context, guestn
|
||||
externalKeyOcRef: ocQosRef,
|
||||
},
|
||||
},
|
||||
&ovn_nb.QoS{
|
||||
{
|
||||
Priority: 1000,
|
||||
Direction: "to-lport",
|
||||
Match: fmt.Sprintf("outport == %q", lportName),
|
||||
@@ -638,6 +739,7 @@ func (keeper *OVNNorthboundKeeper) ClaimGuestnetwork(ctx context.Context, guestn
|
||||
|
||||
irows := []types.IRow{
|
||||
gnp,
|
||||
dhcpOpt,
|
||||
}
|
||||
if gnrDefault != nil {
|
||||
irows = append(irows, gnrDefault)
|
||||
@@ -657,6 +759,8 @@ func (keeper *OVNNorthboundKeeper) ClaimGuestnetwork(ctx context.Context, guestn
|
||||
}
|
||||
|
||||
args = append(args, ovnCreateArgs(gnp, gnp.Name)...)
|
||||
args = append(args, ovnCreateArgs(dhcpOpt, dhcpOptName)...)
|
||||
args = append(args, "--", "add", "Logical_Switch_Port", gnp.Name, "dhcpv4_options", "@"+dhcpOptName)
|
||||
args = append(args, "--", "add", "Logical_Switch", netLsName(guestnetwork.NetworkId), "ports", "@"+gnp.Name)
|
||||
if gnrDefault != nil {
|
||||
args = append(args, ovnCreateArgs(gnrDefault, "gnrDefault")...)
|
||||
|
||||
@@ -168,7 +168,7 @@ func (w *Worker) run(ctx context.Context, mss *agentmodels.ModelSets) (err error
|
||||
|
||||
ovndb.ClaimVpcHost(ctx, vpc, host)
|
||||
}
|
||||
ovndb.ClaimGuestnetwork(ctx, guestnetwork)
|
||||
ovndb.ClaimGuestnetwork(ctx, guestnetwork, w.opts)
|
||||
}
|
||||
for _, groupnetwork := range network.Groupnetworks {
|
||||
ovndb.ClaimGroupnetwork(ctx, groupnetwork)
|
||||
|
||||
@@ -25,16 +25,31 @@ import (
|
||||
"yunion.io/x/log"
|
||||
"yunion.io/x/pkg/appctx"
|
||||
|
||||
"yunion.io/x/onecloud/pkg/apis"
|
||||
app_common "yunion.io/x/onecloud/pkg/cloudcommon/app"
|
||||
"yunion.io/x/onecloud/pkg/cloudcommon/consts"
|
||||
"yunion.io/x/onecloud/pkg/cloudcommon/notifyclient"
|
||||
common_options "yunion.io/x/onecloud/pkg/cloudcommon/options"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/auth"
|
||||
identity_modules "yunion.io/x/onecloud/pkg/mcclient/modules/identity"
|
||||
"yunion.io/x/onecloud/pkg/vpcagent/options"
|
||||
_ "yunion.io/x/onecloud/pkg/vpcagent/ovn"
|
||||
"yunion.io/x/onecloud/pkg/vpcagent/worker"
|
||||
)
|
||||
|
||||
func updateDnsOptions(ctx context.Context, opts *options.Options) {
|
||||
regionConfig, err := identity_modules.ServicesV3.GetConfig(auth.GetAdminSession(ctx, opts.Region), apis.SERVICE_TYPE_REGION)
|
||||
if err != nil {
|
||||
log.Fatalf("fail to retrieve compute config")
|
||||
}
|
||||
if opts.DNSDomain == "" {
|
||||
opts.DNSDomain, _ = regionConfig.GetString("default", "dns_domain")
|
||||
}
|
||||
if opts.DNSServer == "" {
|
||||
opts.DNSServer, _ = regionConfig.GetString("default", "dns_server")
|
||||
}
|
||||
}
|
||||
|
||||
func StartService() {
|
||||
opts := &options.Options{}
|
||||
commonOpts := &opts.CommonOptions
|
||||
@@ -43,6 +58,8 @@ func StartService() {
|
||||
app_common.InitAuth(commonOpts, func() {
|
||||
log.Infof("auth finished ok")
|
||||
})
|
||||
common_options.StartOptionManager(opts, opts.ConfigSyncPeriodSeconds, apis.SERVICE_TYPE_VPCAGENT, "", options.OnOptionsChange)
|
||||
|
||||
}
|
||||
if err := opts.ValidateThenInit(); err != nil {
|
||||
log.Fatalf("opts validate: %s", err)
|
||||
@@ -67,6 +84,11 @@ func StartService() {
|
||||
wg := &sync.WaitGroup{}
|
||||
ctx = context.WithValue(ctx, "wg", wg)
|
||||
ctx = context.WithValue(ctx, appctx.APP_CONTEXT_KEY_APPNAME, "vpcagent")
|
||||
|
||||
if opts.DNSDomain == "" || opts.DNSServer == "" {
|
||||
updateDnsOptions(ctx, opts)
|
||||
}
|
||||
|
||||
wg.Add(1)
|
||||
go w.Start(ctx, app, "vpcagent")
|
||||
|
||||
|
||||
@@ -68,31 +68,33 @@ func resolveServerIPPortById(ctx context.Context, s *mcclient.ClientSession, id
|
||||
}
|
||||
|
||||
// find nics
|
||||
var guestNicDetails compute_api.GuestnetworkDetails
|
||||
var guestNicDetails *compute_api.GuestnetworkDetails
|
||||
if result.Total == 1 {
|
||||
err := result.Data[0].Unmarshal(&guestNicDetails)
|
||||
gn := compute_api.GuestnetworkDetails{}
|
||||
err := result.Data[0].Unmarshal(&gn)
|
||||
if err != nil {
|
||||
return "", 0, nil, errors.Wrap(err, "Unmarshal guest network info")
|
||||
}
|
||||
if len(ip) > 0 && ip != guestNicDetails.EipAddr && ip != guestNicDetails.IpAddr && ip != guestNicDetails.Ip6Addr {
|
||||
if len(ip) > 0 && ip != gn.EipAddr && ip != gn.IpAddr && ip != gn.Ip6Addr {
|
||||
return "", 0, nil, errors.Wrapf(httperrors.ErrInputParameter, "ip %s not match with server", ip)
|
||||
}
|
||||
guestNicDetails = &gn
|
||||
} else {
|
||||
if len(ip) == 0 {
|
||||
return "", 0, nil, errors.Wrap(httperrors.ErrInputParameter, "must specify ip")
|
||||
}
|
||||
find := false
|
||||
for _, gnJson := range result.Data {
|
||||
err := gnJson.Unmarshal(&guestNicDetails)
|
||||
gn := compute_api.GuestnetworkDetails{}
|
||||
err := gnJson.Unmarshal(&gn)
|
||||
if err != nil {
|
||||
return "", 0, nil, errors.Wrap(err, "Unmarshal guest network info")
|
||||
}
|
||||
if ip == guestNicDetails.EipAddr || ip == guestNicDetails.IpAddr || ip == guestNicDetails.Ip6Addr {
|
||||
find = true
|
||||
if ip == gn.EipAddr || ip == gn.IpAddr || ip == gn.Ip6Addr {
|
||||
guestNicDetails = &gn
|
||||
break
|
||||
}
|
||||
}
|
||||
if !find {
|
||||
if guestNicDetails == nil {
|
||||
return "", 0, nil, errors.Wrap(httperrors.ErrInputParameter, "ip specified not match with server")
|
||||
}
|
||||
}
|
||||
|
||||
+24
-9
@@ -416,8 +416,10 @@ const (
|
||||
multicastPrefix = "224.0.0.0/4"
|
||||
)
|
||||
|
||||
var privatePrefixes []IPV4Prefix
|
||||
var privateIPRanges []IPV4AddrRange
|
||||
var customizedPrivateIPRanges []IPV4AddrRange
|
||||
|
||||
// var customizedPrivateIPRanges []IPV4AddrRange
|
||||
var hostLocalIPRange IPV4AddrRange
|
||||
var linkLocalIPRange IPV4AddrRange
|
||||
var multicastIPRange IPV4AddrRange
|
||||
@@ -443,29 +445,42 @@ func initPrivateIPRanges() {
|
||||
"198.18.0.0/15",
|
||||
"192.168.0.0/16",
|
||||
}
|
||||
privateIPRanges = make([]IPV4AddrRange, len(prefs))
|
||||
for i, prefix := range prefs {
|
||||
|
||||
privatePrefixes = make([]IPV4Prefix, 0)
|
||||
privateIPRanges = make([]IPV4AddrRange, 0)
|
||||
for _, prefix := range prefs {
|
||||
prefix, err := NewIPV4Prefix(prefix)
|
||||
if err != nil {
|
||||
continue
|
||||
}
|
||||
privateIPRanges[i] = prefix.ToIPRange()
|
||||
privatePrefixes = append(privatePrefixes, prefix)
|
||||
privateIPRanges = append(privateIPRanges, prefix.ToIPRange())
|
||||
}
|
||||
}
|
||||
|
||||
func SetPrivatePrefixes(pref []string) {
|
||||
customizedPrivateIPRanges = make([]IPV4AddrRange, 0)
|
||||
for _, prefix := range pref {
|
||||
prefix, err := NewIPV4Prefix(prefix)
|
||||
for _, prefStr := range pref {
|
||||
find := false
|
||||
for i := range privatePrefixes {
|
||||
if privatePrefixes[i].String() == prefStr {
|
||||
find = true
|
||||
break
|
||||
}
|
||||
}
|
||||
if find {
|
||||
continue
|
||||
}
|
||||
prefix, err := NewIPV4Prefix(prefStr)
|
||||
if err != nil {
|
||||
continue
|
||||
}
|
||||
customizedPrivateIPRanges = append(customizedPrivateIPRanges, prefix.ToIPRange())
|
||||
privatePrefixes = append(privatePrefixes, prefix)
|
||||
privateIPRanges = append(privateIPRanges, prefix.ToIPRange())
|
||||
}
|
||||
}
|
||||
|
||||
func GetPrivateIPRanges() []IPV4AddrRange {
|
||||
return append(privateIPRanges, customizedPrivateIPRanges...)
|
||||
return privateIPRanges
|
||||
}
|
||||
|
||||
func IsPrivate(addr IPV4Addr) bool {
|
||||
|
||||
Reference in New Issue
Block a user