mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-24 16:03:43 +08:00
Update fmt
This commit is contained in:
@@ -7,10 +7,10 @@ import (
|
||||
|
||||
"github.com/yunionio/jsonutils"
|
||||
"github.com/yunionio/log"
|
||||
"github.com/yunionio/onecloud/pkg/mcclient/modules"
|
||||
"github.com/yunionio/onecloud/pkg/appctx"
|
||||
"github.com/yunionio/onecloud/pkg/appsrv"
|
||||
"github.com/yunionio/onecloud/pkg/httperrors"
|
||||
"github.com/yunionio/onecloud/pkg/mcclient/modules"
|
||||
)
|
||||
|
||||
func AddModelDispatcher(prefix string, app *appsrv.Application, manager IModelDispatchHandler) {
|
||||
|
||||
@@ -4,8 +4,8 @@ import (
|
||||
"context"
|
||||
|
||||
"github.com/yunionio/jsonutils"
|
||||
"github.com/yunionio/onecloud/pkg/mcclient/modules"
|
||||
"github.com/yunionio/onecloud/pkg/appsrv"
|
||||
"github.com/yunionio/onecloud/pkg/mcclient/modules"
|
||||
)
|
||||
|
||||
type IMiddlewareFilter interface {
|
||||
|
||||
@@ -7,10 +7,10 @@ import (
|
||||
|
||||
"github.com/yunionio/jsonutils"
|
||||
"github.com/yunionio/log"
|
||||
"github.com/yunionio/onecloud/pkg/mcclient/modules"
|
||||
"github.com/yunionio/onecloud/pkg/appctx"
|
||||
"github.com/yunionio/onecloud/pkg/appsrv"
|
||||
"github.com/yunionio/onecloud/pkg/httperrors"
|
||||
"github.com/yunionio/onecloud/pkg/mcclient/modules"
|
||||
)
|
||||
|
||||
func AddJointModelDispatcher(prefix string, app *appsrv.Application, manager IJointModelDispatchHandler) {
|
||||
|
||||
@@ -4,8 +4,8 @@ import (
|
||||
"strings"
|
||||
|
||||
"github.com/yunionio/jsonutils"
|
||||
"github.com/yunionio/onecloud/pkg/mcclient"
|
||||
"github.com/yunionio/onecloud/pkg/httperrors"
|
||||
"github.com/yunionio/onecloud/pkg/mcclient"
|
||||
"github.com/yunionio/pkg/utils"
|
||||
)
|
||||
|
||||
|
||||
@@ -9,14 +9,14 @@ import (
|
||||
|
||||
"github.com/yunionio/jsonutils"
|
||||
"github.com/yunionio/log"
|
||||
"github.com/yunionio/onecloud/pkg/appsrv"
|
||||
"github.com/yunionio/onecloud/pkg/httperrors"
|
||||
"github.com/yunionio/onecloud/pkg/mcclient"
|
||||
"github.com/yunionio/onecloud/pkg/mcclient/auth"
|
||||
"github.com/yunionio/onecloud/pkg/mcclient/modules"
|
||||
"github.com/yunionio/onecloud/pkg/appsrv"
|
||||
"github.com/yunionio/pkg/gotypes"
|
||||
"github.com/yunionio/onecloud/pkg/httperrors"
|
||||
"github.com/yunionio/pkg/util/filterclause"
|
||||
"github.com/yunionio/onecloud/pkg/util/httputils"
|
||||
"github.com/yunionio/pkg/gotypes"
|
||||
"github.com/yunionio/pkg/util/filterclause"
|
||||
"github.com/yunionio/pkg/utils"
|
||||
"github.com/yunionio/sqlchemy"
|
||||
|
||||
|
||||
@@ -7,9 +7,9 @@ import (
|
||||
|
||||
"github.com/yunionio/jsonutils"
|
||||
"github.com/yunionio/log"
|
||||
"github.com/yunionio/onecloud/pkg/httperrors"
|
||||
"github.com/yunionio/onecloud/pkg/mcclient"
|
||||
"github.com/yunionio/onecloud/pkg/mcclient/modules"
|
||||
"github.com/yunionio/onecloud/pkg/httperrors"
|
||||
|
||||
"github.com/yunionio/onecloud/pkg/cloudcommon/db/lockman"
|
||||
)
|
||||
|
||||
@@ -7,8 +7,8 @@ import (
|
||||
|
||||
"github.com/yunionio/jsonutils"
|
||||
"github.com/yunionio/log"
|
||||
"github.com/yunionio/onecloud/pkg/mcclient"
|
||||
"github.com/yunionio/onecloud/pkg/httperrors"
|
||||
"github.com/yunionio/onecloud/pkg/mcclient"
|
||||
"github.com/yunionio/pkg/util/regutils"
|
||||
"github.com/yunionio/pkg/util/stringutils"
|
||||
"github.com/yunionio/pkg/utils"
|
||||
|
||||
@@ -10,8 +10,8 @@ import (
|
||||
|
||||
"github.com/yunionio/jsonutils"
|
||||
"github.com/yunionio/log"
|
||||
"github.com/yunionio/onecloud/pkg/mcclient"
|
||||
"github.com/yunionio/onecloud/pkg/appctx"
|
||||
"github.com/yunionio/onecloud/pkg/mcclient"
|
||||
"github.com/yunionio/onecloud/pkg/util/httputils"
|
||||
"github.com/yunionio/pkg/util/reflectutils"
|
||||
"github.com/yunionio/pkg/util/stringutils"
|
||||
|
||||
@@ -7,8 +7,8 @@ import (
|
||||
|
||||
"github.com/yunionio/jsonutils"
|
||||
"github.com/yunionio/log"
|
||||
"github.com/yunionio/onecloud/pkg/mcclient"
|
||||
"github.com/yunionio/onecloud/pkg/httperrors"
|
||||
"github.com/yunionio/onecloud/pkg/mcclient"
|
||||
"github.com/yunionio/pkg/util/reflectutils"
|
||||
"github.com/yunionio/sqlchemy"
|
||||
)
|
||||
|
||||
@@ -8,8 +8,8 @@ import (
|
||||
|
||||
"github.com/yunionio/jsonutils"
|
||||
"github.com/yunionio/log"
|
||||
"github.com/yunionio/onecloud/pkg/mcclient"
|
||||
"github.com/yunionio/onecloud/pkg/httperrors"
|
||||
"github.com/yunionio/onecloud/pkg/mcclient"
|
||||
"github.com/yunionio/pkg/util/timeutils"
|
||||
"github.com/yunionio/pkg/utils"
|
||||
"github.com/yunionio/sqlchemy"
|
||||
|
||||
@@ -7,8 +7,8 @@ import (
|
||||
|
||||
"github.com/yunionio/jsonutils"
|
||||
"github.com/yunionio/log"
|
||||
"github.com/yunionio/onecloud/pkg/mcclient"
|
||||
"github.com/yunionio/onecloud/pkg/httperrors"
|
||||
"github.com/yunionio/onecloud/pkg/mcclient"
|
||||
"github.com/yunionio/pkg/util/seclib"
|
||||
"github.com/yunionio/pkg/utils"
|
||||
|
||||
|
||||
@@ -116,7 +116,6 @@ func (self *SManagedVirtualizedGuestDriver) RequestSyncstatusOnHost(ctx context.
|
||||
return body, nil
|
||||
}
|
||||
|
||||
|
||||
func (self *SManagedVirtualizedGuestDriver) GetGuestVncInfo(userCred mcclient.TokenCredential, guest *models.SGuest, host *models.SHost) (*jsonutils.JSONDict, error) {
|
||||
ihost, err := host.GetIHost()
|
||||
if err != nil {
|
||||
@@ -137,4 +136,4 @@ func (self *SManagedVirtualizedGuestDriver) GetGuestVncInfo(userCred mcclient.To
|
||||
dataDict := data.(*jsonutils.JSONDict)
|
||||
|
||||
return dataDict, nil
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,8 +6,8 @@ import (
|
||||
"regexp"
|
||||
|
||||
"github.com/yunionio/jsonutils"
|
||||
"github.com/yunionio/onecloud/pkg/mcclient"
|
||||
"github.com/yunionio/onecloud/pkg/httperrors"
|
||||
"github.com/yunionio/onecloud/pkg/mcclient"
|
||||
|
||||
"github.com/yunionio/onecloud/pkg/cloudcommon/db/quotas"
|
||||
"github.com/yunionio/onecloud/pkg/cloudcommon/db/taskman"
|
||||
|
||||
@@ -8,10 +8,10 @@ import (
|
||||
|
||||
"github.com/yunionio/jsonutils"
|
||||
"github.com/yunionio/log"
|
||||
"github.com/yunionio/onecloud/pkg/httperrors"
|
||||
"github.com/yunionio/onecloud/pkg/mcclient"
|
||||
"github.com/yunionio/onecloud/pkg/mcclient/auth"
|
||||
"github.com/yunionio/onecloud/pkg/mcclient/modules"
|
||||
"github.com/yunionio/onecloud/pkg/httperrors"
|
||||
"github.com/yunionio/pkg/util/timeutils"
|
||||
"github.com/yunionio/sqlchemy"
|
||||
|
||||
|
||||
@@ -2,14 +2,14 @@ package models
|
||||
|
||||
import (
|
||||
"context"
|
||||
"database/sql"
|
||||
"fmt"
|
||||
"time"
|
||||
"database/sql"
|
||||
|
||||
"github.com/yunionio/jsonutils"
|
||||
"github.com/yunionio/log"
|
||||
"github.com/yunionio/onecloud/pkg/mcclient"
|
||||
"github.com/yunionio/onecloud/pkg/httperrors"
|
||||
"github.com/yunionio/onecloud/pkg/mcclient"
|
||||
"github.com/yunionio/pkg/util/timeutils"
|
||||
"github.com/yunionio/pkg/utils"
|
||||
|
||||
@@ -284,7 +284,6 @@ func (manager *SCloudproviderManager) FetchCloudproviderByIdOrName(providerId st
|
||||
return providerObj.(*SCloudprovider)
|
||||
}
|
||||
|
||||
|
||||
type SCloudproviderUsage struct {
|
||||
HostCount int
|
||||
VpcCount int
|
||||
@@ -383,4 +382,4 @@ func (manager *SCloudproviderManager) migrateVCenterInfo(vc *SVCenter) error {
|
||||
cp.Provider = CLOUD_PROVIDER_VMWARE
|
||||
|
||||
return manager.TableSpec().Insert(&cp)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,8 +6,8 @@ import (
|
||||
|
||||
"github.com/yunionio/jsonutils"
|
||||
"github.com/yunionio/log"
|
||||
"github.com/yunionio/onecloud/pkg/mcclient"
|
||||
"github.com/yunionio/onecloud/pkg/httperrors"
|
||||
"github.com/yunionio/onecloud/pkg/mcclient"
|
||||
"github.com/yunionio/pkg/util/compare"
|
||||
"github.com/yunionio/sqlchemy"
|
||||
|
||||
|
||||
@@ -9,8 +9,8 @@ import (
|
||||
|
||||
"github.com/yunionio/jsonutils"
|
||||
"github.com/yunionio/log"
|
||||
"github.com/yunionio/onecloud/pkg/mcclient"
|
||||
"github.com/yunionio/onecloud/pkg/httperrors"
|
||||
"github.com/yunionio/onecloud/pkg/mcclient"
|
||||
"github.com/yunionio/pkg/tristate"
|
||||
"github.com/yunionio/pkg/util/compare"
|
||||
"github.com/yunionio/pkg/util/fileutils"
|
||||
|
||||
@@ -5,9 +5,9 @@ import (
|
||||
|
||||
"github.com/yunionio/jsonutils"
|
||||
"github.com/yunionio/log"
|
||||
"github.com/yunionio/onecloud/pkg/mcclient"
|
||||
"github.com/yunionio/onecloud/pkg/cloudcommon/db/quotas"
|
||||
"github.com/yunionio/onecloud/pkg/cloudcommon/db/taskman"
|
||||
"github.com/yunionio/onecloud/pkg/mcclient"
|
||||
)
|
||||
|
||||
type IGuestDriver interface {
|
||||
|
||||
@@ -5,8 +5,8 @@ import (
|
||||
|
||||
"github.com/yunionio/jsonutils"
|
||||
"github.com/yunionio/log"
|
||||
"github.com/yunionio/onecloud/pkg/mcclient"
|
||||
"github.com/yunionio/onecloud/pkg/cloudcommon/db"
|
||||
"github.com/yunionio/onecloud/pkg/mcclient"
|
||||
)
|
||||
|
||||
type SHostschedtagManager struct {
|
||||
|
||||
@@ -5,9 +5,9 @@ import (
|
||||
"fmt"
|
||||
|
||||
"github.com/yunionio/jsonutils"
|
||||
"github.com/yunionio/onecloud/pkg/mcclient"
|
||||
"github.com/yunionio/onecloud/pkg/cloudcommon/db"
|
||||
"github.com/yunionio/onecloud/pkg/httperrors"
|
||||
"github.com/yunionio/onecloud/pkg/mcclient"
|
||||
"github.com/yunionio/pkg/tristate"
|
||||
"github.com/yunionio/sqlchemy"
|
||||
)
|
||||
|
||||
@@ -4,9 +4,9 @@ import (
|
||||
"context"
|
||||
|
||||
"github.com/yunionio/jsonutils"
|
||||
"github.com/yunionio/onecloud/pkg/mcclient"
|
||||
"github.com/yunionio/onecloud/pkg/cloudcommon/db"
|
||||
"github.com/yunionio/onecloud/pkg/httperrors"
|
||||
"github.com/yunionio/onecloud/pkg/mcclient"
|
||||
"github.com/yunionio/sqlchemy"
|
||||
)
|
||||
|
||||
|
||||
@@ -7,9 +7,9 @@ import (
|
||||
|
||||
"github.com/yunionio/jsonutils"
|
||||
"github.com/yunionio/log"
|
||||
"github.com/yunionio/onecloud/pkg/mcclient"
|
||||
"github.com/yunionio/onecloud/pkg/cloudcommon/db"
|
||||
"github.com/yunionio/onecloud/pkg/httperrors"
|
||||
"github.com/yunionio/onecloud/pkg/mcclient"
|
||||
"github.com/yunionio/pkg/util/regutils"
|
||||
"github.com/yunionio/pkg/utils"
|
||||
"github.com/yunionio/sqlchemy"
|
||||
|
||||
@@ -6,8 +6,8 @@ import (
|
||||
|
||||
"github.com/yunionio/jsonutils"
|
||||
"github.com/yunionio/log"
|
||||
"github.com/yunionio/onecloud/pkg/mcclient"
|
||||
"github.com/yunionio/onecloud/pkg/cloudcommon/db"
|
||||
"github.com/yunionio/onecloud/pkg/mcclient"
|
||||
"github.com/yunionio/pkg/util/regutils"
|
||||
)
|
||||
|
||||
|
||||
@@ -6,9 +6,9 @@ import (
|
||||
|
||||
"github.com/yunionio/jsonutils"
|
||||
"github.com/yunionio/log"
|
||||
"github.com/yunionio/onecloud/pkg/mcclient"
|
||||
"github.com/yunionio/onecloud/pkg/cloudcommon/db"
|
||||
"github.com/yunionio/onecloud/pkg/httperrors"
|
||||
"github.com/yunionio/onecloud/pkg/mcclient"
|
||||
"github.com/yunionio/sqlchemy"
|
||||
)
|
||||
|
||||
|
||||
@@ -7,9 +7,9 @@ import (
|
||||
|
||||
"github.com/yunionio/jsonutils"
|
||||
"github.com/yunionio/log"
|
||||
"github.com/yunionio/onecloud/pkg/mcclient"
|
||||
"github.com/yunionio/onecloud/pkg/cloudcommon/db"
|
||||
"github.com/yunionio/onecloud/pkg/httperrors"
|
||||
"github.com/yunionio/onecloud/pkg/mcclient"
|
||||
"github.com/yunionio/pkg/utils"
|
||||
"github.com/yunionio/sqlchemy"
|
||||
)
|
||||
|
||||
@@ -8,9 +8,9 @@ import (
|
||||
|
||||
"github.com/yunionio/jsonutils"
|
||||
"github.com/yunionio/log"
|
||||
"github.com/yunionio/onecloud/pkg/mcclient"
|
||||
"github.com/yunionio/onecloud/pkg/cloudcommon/db"
|
||||
"github.com/yunionio/onecloud/pkg/httperrors"
|
||||
"github.com/yunionio/onecloud/pkg/mcclient"
|
||||
"github.com/yunionio/pkg/util/secrules"
|
||||
"github.com/yunionio/pkg/util/stringutils"
|
||||
"github.com/yunionio/sqlchemy"
|
||||
|
||||
@@ -6,9 +6,9 @@ import (
|
||||
|
||||
"github.com/yunionio/jsonutils"
|
||||
"github.com/yunionio/log"
|
||||
"github.com/yunionio/onecloud/pkg/mcclient"
|
||||
"github.com/yunionio/onecloud/pkg/cloudcommon/db"
|
||||
"github.com/yunionio/onecloud/pkg/httperrors"
|
||||
"github.com/yunionio/onecloud/pkg/mcclient"
|
||||
"github.com/yunionio/sqlchemy"
|
||||
)
|
||||
|
||||
|
||||
@@ -7,10 +7,10 @@ import (
|
||||
|
||||
"github.com/yunionio/jsonutils"
|
||||
"github.com/yunionio/log"
|
||||
"github.com/yunionio/onecloud/pkg/mcclient"
|
||||
"github.com/yunionio/onecloud/pkg/cloudcommon/db"
|
||||
"github.com/yunionio/onecloud/pkg/cloudcommon/db/lockman"
|
||||
"github.com/yunionio/onecloud/pkg/httperrors"
|
||||
"github.com/yunionio/onecloud/pkg/mcclient"
|
||||
"github.com/yunionio/pkg/utils"
|
||||
"github.com/yunionio/sqlchemy"
|
||||
)
|
||||
|
||||
@@ -6,11 +6,11 @@ import (
|
||||
|
||||
"github.com/yunionio/jsonutils"
|
||||
"github.com/yunionio/log"
|
||||
"github.com/yunionio/onecloud/pkg/mcclient"
|
||||
"github.com/yunionio/onecloud/pkg/cloudcommon/db"
|
||||
"github.com/yunionio/onecloud/pkg/cloudcommon/db/taskman"
|
||||
"github.com/yunionio/onecloud/pkg/cloudprovider"
|
||||
"github.com/yunionio/onecloud/pkg/httperrors"
|
||||
"github.com/yunionio/onecloud/pkg/mcclient"
|
||||
"github.com/yunionio/sqlchemy"
|
||||
)
|
||||
|
||||
|
||||
@@ -5,11 +5,11 @@ import (
|
||||
|
||||
"github.com/yunionio/jsonutils"
|
||||
"github.com/yunionio/log"
|
||||
"github.com/yunionio/onecloud/pkg/mcclient"
|
||||
"github.com/yunionio/onecloud/pkg/cloudcommon/db"
|
||||
"github.com/yunionio/onecloud/pkg/cloudprovider"
|
||||
"github.com/yunionio/onecloud/pkg/compute/options"
|
||||
"github.com/yunionio/onecloud/pkg/httperrors"
|
||||
"github.com/yunionio/onecloud/pkg/mcclient"
|
||||
"github.com/yunionio/pkg/tristate"
|
||||
"github.com/yunionio/pkg/util/compare"
|
||||
"github.com/yunionio/sqlchemy"
|
||||
|
||||
@@ -5,8 +5,8 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/yunionio/jsonutils"
|
||||
"github.com/yunionio/onecloud/pkg/mcclient"
|
||||
"github.com/yunionio/onecloud/pkg/cloudcommon/db"
|
||||
"github.com/yunionio/onecloud/pkg/mcclient"
|
||||
)
|
||||
|
||||
type SVCenterManager struct {
|
||||
|
||||
@@ -7,11 +7,11 @@ import (
|
||||
|
||||
"github.com/yunionio/jsonutils"
|
||||
"github.com/yunionio/log"
|
||||
"github.com/yunionio/onecloud/pkg/mcclient"
|
||||
"github.com/yunionio/onecloud/pkg/cloudcommon/db"
|
||||
"github.com/yunionio/onecloud/pkg/cloudcommon/db/taskman"
|
||||
"github.com/yunionio/onecloud/pkg/cloudprovider"
|
||||
"github.com/yunionio/onecloud/pkg/httperrors"
|
||||
"github.com/yunionio/onecloud/pkg/mcclient"
|
||||
"github.com/yunionio/pkg/util/compare"
|
||||
"github.com/yunionio/pkg/util/netutils"
|
||||
"github.com/yunionio/sqlchemy"
|
||||
|
||||
@@ -7,10 +7,10 @@ import (
|
||||
|
||||
"github.com/yunionio/jsonutils"
|
||||
"github.com/yunionio/log"
|
||||
"github.com/yunionio/onecloud/pkg/mcclient"
|
||||
"github.com/yunionio/onecloud/pkg/cloudcommon/db"
|
||||
"github.com/yunionio/onecloud/pkg/cloudprovider"
|
||||
"github.com/yunionio/onecloud/pkg/httperrors"
|
||||
"github.com/yunionio/onecloud/pkg/mcclient"
|
||||
"github.com/yunionio/pkg/util/compare"
|
||||
"github.com/yunionio/sqlchemy"
|
||||
)
|
||||
|
||||
@@ -6,14 +6,14 @@ import (
|
||||
|
||||
"github.com/yunionio/jsonutils"
|
||||
"github.com/yunionio/log"
|
||||
"github.com/yunionio/onecloud/pkg/mcclient/auth"
|
||||
"github.com/yunionio/onecloud/pkg/mcclient/modules"
|
||||
"github.com/yunionio/onecloud/pkg/cloudcommon/db"
|
||||
"github.com/yunionio/onecloud/pkg/cloudcommon/db/lockman"
|
||||
"github.com/yunionio/onecloud/pkg/cloudcommon/db/taskman"
|
||||
"github.com/yunionio/onecloud/pkg/cloudcommon/notifyclient"
|
||||
"github.com/yunionio/onecloud/pkg/compute/models"
|
||||
"github.com/yunionio/onecloud/pkg/compute/options"
|
||||
"github.com/yunionio/onecloud/pkg/mcclient/auth"
|
||||
"github.com/yunionio/onecloud/pkg/mcclient/modules"
|
||||
)
|
||||
|
||||
type GuestBatchCreateTask struct {
|
||||
|
||||
@@ -7,13 +7,13 @@ import (
|
||||
|
||||
json "github.com/yunionio/jsonutils"
|
||||
"github.com/yunionio/log"
|
||||
"github.com/yunionio/onecloud/pkg/mcclient"
|
||||
"github.com/yunionio/onecloud/pkg/mcclient/auth"
|
||||
"github.com/yunionio/onecloud/pkg/cloudcommon/db"
|
||||
"github.com/yunionio/onecloud/pkg/compute/models"
|
||||
"github.com/yunionio/onecloud/pkg/appctx"
|
||||
"github.com/yunionio/onecloud/pkg/appsrv"
|
||||
"github.com/yunionio/onecloud/pkg/cloudcommon/db"
|
||||
"github.com/yunionio/onecloud/pkg/compute/models"
|
||||
"github.com/yunionio/onecloud/pkg/httperrors"
|
||||
"github.com/yunionio/onecloud/pkg/mcclient"
|
||||
"github.com/yunionio/onecloud/pkg/mcclient/auth"
|
||||
"github.com/yunionio/pkg/tristate"
|
||||
"github.com/yunionio/pkg/utils"
|
||||
)
|
||||
|
||||
@@ -114,4 +114,4 @@ func NewYunionAgentManager(keyword, keywordPlural string, columns, adminColumns
|
||||
adminColumns: adminColumns,
|
||||
serviceType: "yunionagent"},
|
||||
Keyword: keyword, KeywordPlural: keywordPlural}
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+3
-3
@@ -21,9 +21,9 @@ func getUpdate(d []interface{}) ([]string, error) {
|
||||
|
||||
func defaultSyncItems() []cache.CachedItem {
|
||||
return []cache.CachedItem{
|
||||
//newGlanceCache(),
|
||||
//newNetworkCache(),
|
||||
//newNetworksDataCache(),
|
||||
//newGlanceCache(),
|
||||
//newNetworkCache(),
|
||||
//newNetworksDataCache(),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package aliyun
|
||||
|
||||
import (
|
||||
"time"
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"github.com/yunionio/jsonutils"
|
||||
"github.com/yunionio/log"
|
||||
|
||||
@@ -8,4 +8,4 @@ func printList(data interface{}, total, offset, limit int, columns []string) {
|
||||
|
||||
func printObject(obj interface{}) {
|
||||
printutils.PrintInterfaceObject(obj)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,11 +6,11 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/yunionio/log"
|
||||
"github.com/yunionio/onecloud/pkg/cloudprovider"
|
||||
"github.com/yunionio/onecloud/pkg/compute/options"
|
||||
"github.com/yunionio/onecloud/pkg/mcclient"
|
||||
"github.com/yunionio/onecloud/pkg/mcclient/auth"
|
||||
"github.com/yunionio/onecloud/pkg/mcclient/modules"
|
||||
"github.com/yunionio/onecloud/pkg/cloudprovider"
|
||||
"github.com/yunionio/onecloud/pkg/compute/options"
|
||||
)
|
||||
|
||||
type SStoragecache struct {
|
||||
|
||||
@@ -5,12 +5,12 @@ import (
|
||||
"github.com/yunionio/onecloud/pkg/cloudprovider"
|
||||
)
|
||||
|
||||
var DATACENTER_PROPS = []string {"name", "parent", "datastore"}
|
||||
var DATACENTER_PROPS = []string{"name", "parent", "datastore"}
|
||||
|
||||
type SDatacenter struct {
|
||||
SManagedObject
|
||||
|
||||
ihosts []cloudprovider.ICloudHost
|
||||
ihosts []cloudprovider.ICloudHost
|
||||
istorages []cloudprovider.ICloudStorage
|
||||
|
||||
Name string
|
||||
@@ -75,4 +75,4 @@ func (dc *SDatacenter) GetIStorages() ([]cloudprovider.ICloudStorage, error) {
|
||||
return nil, err
|
||||
}
|
||||
return dc.istorages, nil
|
||||
}
|
||||
}
|
||||
|
||||
+44
-46
@@ -5,60 +5,60 @@ import (
|
||||
|
||||
"github.com/yunionio/jsonutils"
|
||||
|
||||
"github.com/yunionio/onecloud/pkg/compute/models"
|
||||
"github.com/yunionio/onecloud/pkg/cloudprovider"
|
||||
"github.com/vmware/govmomi/vim25/types"
|
||||
"github.com/yunionio/pkg/util/netutils"
|
||||
"github.com/yunionio/log"
|
||||
"github.com/yunionio/onecloud/pkg/cloudprovider"
|
||||
"github.com/yunionio/onecloud/pkg/compute/models"
|
||||
"github.com/yunionio/pkg/util/netutils"
|
||||
)
|
||||
|
||||
var HOST_SYSTEM_PROPS = []string {"name", "parent", "summary", "config", "hardware", "vm"}
|
||||
var HOST_SYSTEM_PROPS = []string{"name", "parent", "summary", "config", "hardware", "vm"}
|
||||
|
||||
type SHostNicInfo struct {
|
||||
Dev string
|
||||
Driver string
|
||||
Mac string
|
||||
Index int
|
||||
LinkUp bool
|
||||
IpAddr string
|
||||
Mtu int
|
||||
Dev string
|
||||
Driver string
|
||||
Mac string
|
||||
Index int
|
||||
LinkUp bool
|
||||
IpAddr string
|
||||
Mtu int
|
||||
NicType string
|
||||
}
|
||||
|
||||
type SHostStorageAdapterInfo struct {
|
||||
Device string
|
||||
Model string
|
||||
Driver string
|
||||
Pci string
|
||||
Drivers []SHostStorageDriverInfo
|
||||
Device string
|
||||
Model string
|
||||
Driver string
|
||||
Pci string
|
||||
Drivers []SHostStorageDriverInfo
|
||||
Enclosure int
|
||||
}
|
||||
|
||||
type SHostStorageDriverInfo struct {
|
||||
CN string
|
||||
Name string
|
||||
Model string
|
||||
Vendor string
|
||||
CN string
|
||||
Name string
|
||||
Model string
|
||||
Vendor string
|
||||
Revision string
|
||||
Status string
|
||||
SSD bool
|
||||
Dev string
|
||||
Size int
|
||||
Status string
|
||||
SSD bool
|
||||
Dev string
|
||||
Size int
|
||||
}
|
||||
|
||||
type SHostStorageEnclosureInfo struct {
|
||||
CN string
|
||||
Name string
|
||||
Model string
|
||||
Vendor string
|
||||
CN string
|
||||
Name string
|
||||
Model string
|
||||
Vendor string
|
||||
Revision string
|
||||
Status string
|
||||
Status string
|
||||
}
|
||||
|
||||
type SHost struct {
|
||||
SManagedObject
|
||||
|
||||
nicInfo []SHostNicInfo
|
||||
nicInfo []SHostNicInfo
|
||||
storageInfo []SHostStorageAdapterInfo
|
||||
|
||||
vms []cloudprovider.ICloudVM
|
||||
@@ -72,18 +72,17 @@ func (self *SHost) getHostSystem() *mo.HostSystem {
|
||||
return self.object.(*mo.HostSystem)
|
||||
}
|
||||
|
||||
|
||||
func (self *SHost) GetGlobalId() string {
|
||||
return self.GetAccessIp()
|
||||
}
|
||||
|
||||
func (self *SHost) GetStatus() string {
|
||||
/*
|
||||
HostSystemPowerStatePoweredOn = HostSystemPowerState("poweredOn")
|
||||
HostSystemPowerStatePoweredOff = HostSystemPowerState("poweredOff")
|
||||
HostSystemPowerStateStandBy = HostSystemPowerState("standBy")
|
||||
HostSystemPowerStateUnknown = HostSystemPowerState("unknown")
|
||||
*/
|
||||
HostSystemPowerStatePoweredOn = HostSystemPowerState("poweredOn")
|
||||
HostSystemPowerStatePoweredOff = HostSystemPowerState("poweredOff")
|
||||
HostSystemPowerStateStandBy = HostSystemPowerState("standBy")
|
||||
HostSystemPowerStateUnknown = HostSystemPowerState("unknown")
|
||||
*/
|
||||
switch self.getHostSystem().Summary.Runtime.PowerState {
|
||||
case types.HostSystemPowerStatePoweredOn:
|
||||
return models.HOST_STATUS_RUNNING
|
||||
@@ -143,7 +142,7 @@ func (self *SHost) GetIVMById(id string) (cloudprovider.ICloudVM, error) {
|
||||
if vms[i].GetGlobalId() == id {
|
||||
return vms[i], nil
|
||||
}
|
||||
}
|
||||
}
|
||||
return nil, cloudprovider.ErrNotFound
|
||||
}
|
||||
|
||||
@@ -165,10 +164,10 @@ func (self *SHost) GetEnabled() bool {
|
||||
|
||||
func (self *SHost) GetHostStatus() string {
|
||||
/*
|
||||
HostSystemConnectionStateConnected = HostSystemConnectionState("connected")
|
||||
HostSystemConnectionStateNotResponding = HostSystemConnectionState("notResponding")
|
||||
HostSystemConnectionStateDisconnected = HostSystemConnectionState("disconnected")
|
||||
*/
|
||||
HostSystemConnectionStateConnected = HostSystemConnectionState("connected")
|
||||
HostSystemConnectionStateNotResponding = HostSystemConnectionState("notResponding")
|
||||
HostSystemConnectionStateDisconnected = HostSystemConnectionState("disconnected")
|
||||
*/
|
||||
switch self.getHostSystem().Summary.Runtime.ConnectionState {
|
||||
case types.HostSystemConnectionStateConnected:
|
||||
return models.HOST_ONLINE
|
||||
@@ -177,7 +176,6 @@ func (self *SHost) GetHostStatus() string {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
func findHostNicByMac(nicInfoList []SHostNicInfo, mac string) *SHostNicInfo {
|
||||
for i := 0; i < len(nicInfoList); i += 1 {
|
||||
if nicInfoList[i].Mac == mac {
|
||||
@@ -256,8 +254,8 @@ func (self *SHost) GetAccessMac() string {
|
||||
}
|
||||
|
||||
type SSysInfo struct {
|
||||
Manufacture string
|
||||
Model string
|
||||
Manufacture string
|
||||
Model string
|
||||
SerialNumber string
|
||||
}
|
||||
|
||||
@@ -290,7 +288,7 @@ func (self *SHost) GetCpuMhz() int {
|
||||
}
|
||||
|
||||
func (self *SHost) GetMemSizeMB() int {
|
||||
return int(self.getHostSystem().Summary.Hardware.MemorySize/1024/1024)
|
||||
return int(self.getHostSystem().Summary.Hardware.MemorySize / 1024 / 1024)
|
||||
}
|
||||
|
||||
/*func (self *SHost) fetchStorageInfo() {
|
||||
@@ -356,7 +354,7 @@ func (self *SHost) GetManagerId() string {
|
||||
}
|
||||
|
||||
func (self *SHost) CreateVM(name string, imgId string, sysDiskSize int, cpu int, memMB int, vswitchId string, ipAddr string, desc string,
|
||||
passwd string, storageType string, diskSizes []int, publicKey string) (cloudprovider.ICloudVM, error) {
|
||||
passwd string, storageType string, diskSizes []int, publicKey string) (cloudprovider.ICloudVM, error) {
|
||||
log.Debugf("CreateVM")
|
||||
return nil, cloudprovider.ErrNotImplemented
|
||||
}
|
||||
|
||||
@@ -7,17 +7,17 @@ import (
|
||||
"reflect"
|
||||
|
||||
"github.com/vmware/govmomi"
|
||||
"github.com/vmware/govmomi/object"
|
||||
"github.com/vmware/govmomi/property"
|
||||
"github.com/vmware/govmomi/view"
|
||||
"github.com/vmware/govmomi/vim25/mo"
|
||||
"github.com/vmware/govmomi/vim25/types"
|
||||
"github.com/vmware/govmomi/property"
|
||||
"github.com/vmware/govmomi/object"
|
||||
|
||||
"github.com/yunionio/jsonutils"
|
||||
"github.com/yunionio/log"
|
||||
|
||||
"github.com/yunionio/onecloud/pkg/cloudprovider"
|
||||
"github.com/vmware/govmomi/session"
|
||||
"github.com/yunionio/onecloud/pkg/cloudprovider"
|
||||
"github.com/yunionio/onecloud/pkg/compute/models"
|
||||
"strings"
|
||||
)
|
||||
@@ -231,4 +231,4 @@ func (cli *SESXiClient) FindHostByIp(hostIp string) (*SHost, error) {
|
||||
func (cli *SESXiClient) acquireCloneTicket() (string, error) {
|
||||
manager := session.NewManager(cli.client.Client)
|
||||
return manager.AcquireCloneTicket(cli.context)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,14 +3,14 @@ package esxi
|
||||
import (
|
||||
"github.com/vmware/govmomi/vim25/mo"
|
||||
"github.com/yunionio/log"
|
||||
"reflect"
|
||||
"github.com/yunionio/onecloud/pkg/cloudprovider"
|
||||
"reflect"
|
||||
)
|
||||
|
||||
type SManagedObject struct {
|
||||
manager *SESXiClient
|
||||
manager *SESXiClient
|
||||
datacenter *SDatacenter
|
||||
object mo.Entity
|
||||
object mo.Entity
|
||||
|
||||
path []string
|
||||
}
|
||||
@@ -57,7 +57,7 @@ func reverseArray(array interface{}) {
|
||||
return
|
||||
}
|
||||
tmp := reflect.Indirect(reflect.New(arrayValue.Type().Elem()))
|
||||
for i, j := 0, arrayValue.Len() - 1; i < j; i, j = i + 1, j - 1 {
|
||||
for i, j := 0, arrayValue.Len()-1; i < j; i, j = i+1, j-1 {
|
||||
tmpi := arrayValue.Index(i)
|
||||
tmpj := arrayValue.Index(j)
|
||||
tmp.Set(tmpi)
|
||||
@@ -121,4 +121,4 @@ func (self *SManagedObject) GetDatacenterPath() []string {
|
||||
}
|
||||
path := dc.GetPath()
|
||||
return path[1:]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,15 +2,14 @@ package provider
|
||||
|
||||
import (
|
||||
"net/url"
|
||||
"strings"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/yunionio/jsonutils"
|
||||
"github.com/yunionio/log"
|
||||
|
||||
"github.com/yunionio/onecloud/pkg/util/esxi"
|
||||
"github.com/yunionio/onecloud/pkg/cloudprovider"
|
||||
|
||||
"github.com/yunionio/onecloud/pkg/util/esxi"
|
||||
)
|
||||
|
||||
type SESXiProviderFactory struct {
|
||||
@@ -116,4 +115,3 @@ func (self *SESXiProvider) GetIStorageById(id string) (cloudprovider.ICloudStora
|
||||
func (self *SESXiProvider) GetIStoragecacheById(id string) (cloudprovider.ICloudStoragecache, error) {
|
||||
return nil, cloudprovider.ErrNotImplemented
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package shell
|
||||
|
||||
import (
|
||||
"github.com/yunionio/onecloud/pkg/util/shellutils"
|
||||
"github.com/yunionio/onecloud/pkg/util/esxi"
|
||||
"github.com/yunionio/onecloud/pkg/util/shellutils"
|
||||
)
|
||||
|
||||
func init() {
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package shell
|
||||
|
||||
import (
|
||||
"github.com/yunionio/onecloud/pkg/util/shellutils"
|
||||
"github.com/yunionio/onecloud/pkg/util/esxi"
|
||||
"github.com/yunionio/onecloud/pkg/util/shellutils"
|
||||
)
|
||||
|
||||
func init() {
|
||||
@@ -33,4 +33,4 @@ func init() {
|
||||
printObject(host)
|
||||
return nil
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package shell
|
||||
|
||||
import (
|
||||
"github.com/yunionio/onecloud/pkg/util/shellutils"
|
||||
"github.com/yunionio/onecloud/pkg/util/esxi"
|
||||
"github.com/yunionio/onecloud/pkg/util/shellutils"
|
||||
)
|
||||
|
||||
func init() {
|
||||
@@ -21,4 +21,4 @@ func init() {
|
||||
printList(ds, nil)
|
||||
return nil
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@ package shell
|
||||
|
||||
import "github.com/yunionio/onecloud/pkg/util/printutils"
|
||||
|
||||
|
||||
func printList(data interface{}, columns []string) {
|
||||
printutils.PrintGetterList(data, columns)
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package shell
|
||||
|
||||
import (
|
||||
"github.com/yunionio/onecloud/pkg/util/shellutils"
|
||||
"github.com/yunionio/onecloud/pkg/util/esxi"
|
||||
"github.com/yunionio/onecloud/pkg/util/printutils"
|
||||
"github.com/yunionio/onecloud/pkg/util/shellutils"
|
||||
)
|
||||
|
||||
func init() {
|
||||
@@ -25,7 +25,7 @@ func init() {
|
||||
|
||||
type VirtualMachineShowOptions struct {
|
||||
HOSTIP string `help:"Host IP"`
|
||||
VMID string `help:"VM ID"`
|
||||
VMID string `help:"VM ID"`
|
||||
}
|
||||
shellutils.R(&VirtualMachineShowOptions{}, "vm-show", "Show vm details", func(cli *esxi.SESXiClient, args *VirtualMachineShowOptions) error {
|
||||
host, err := cli.FindHostByIp(args.HOSTIP)
|
||||
|
||||
@@ -8,8 +8,7 @@ import (
|
||||
"github.com/yunionio/onecloud/pkg/compute/models"
|
||||
)
|
||||
|
||||
var DATASTORE_PROPS = []string {"name", "parent"}
|
||||
|
||||
var DATASTORE_PROPS = []string{"name", "parent"}
|
||||
|
||||
type SDatastore struct {
|
||||
SManagedObject
|
||||
@@ -86,4 +85,4 @@ func (self *SDatastore) GetManagerId() string {
|
||||
|
||||
func (self *SDatastore) CreateIDisk(name string, sizeGb int, desc string) (cloudprovider.ICloudDisk, error) {
|
||||
return nil, cloudprovider.ErrNotImplemented
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,8 +11,8 @@ import (
|
||||
"github.com/yunionio/onecloud/pkg/cloudprovider"
|
||||
"github.com/yunionio/onecloud/pkg/compute/models"
|
||||
|
||||
"github.com/vmware/govmomi/object"
|
||||
"fmt"
|
||||
"github.com/vmware/govmomi/object"
|
||||
)
|
||||
|
||||
var VIRTUAL_MACHINE_PROPS = []string{"name", "parent", "runtime", "summary"}
|
||||
@@ -31,7 +31,6 @@ func (self *SVirtualMachine) getVirtualMachine() *mo.VirtualMachine {
|
||||
return self.object.(*mo.VirtualMachine)
|
||||
}
|
||||
|
||||
|
||||
func (self *SVirtualMachine) GetGlobalId() string {
|
||||
return self.getUuid()
|
||||
}
|
||||
@@ -178,12 +177,12 @@ func (self *SVirtualMachine) acquireWebmksTicket(ticketType string) (jsonutils.J
|
||||
port = 443
|
||||
}
|
||||
/*
|
||||
ret.Add(jsonutils.NewString(ticketType), "type")
|
||||
ret.Add(jsonutils.NewString(ticket.Host), "host")
|
||||
ret.Add(jsonutils.NewInt(int64(ticket.Port)), "port")
|
||||
ret.Add(jsonutils.NewString(ticket.Ticket), "ticket")
|
||||
ret.Add(jsonutils.NewString(ticket.SslThumbprint), "slThumbprint")
|
||||
ret.Add(jsonutils.NewString(ticket.CfgFile), "cfgFile")
|
||||
ret.Add(jsonutils.NewString(ticketType), "type")
|
||||
ret.Add(jsonutils.NewString(ticket.Host), "host")
|
||||
ret.Add(jsonutils.NewInt(int64(ticket.Port)), "port")
|
||||
ret.Add(jsonutils.NewString(ticket.Ticket), "ticket")
|
||||
ret.Add(jsonutils.NewString(ticket.SslThumbprint), "slThumbprint")
|
||||
ret.Add(jsonutils.NewString(ticket.CfgFile), "cfgFile")
|
||||
*/
|
||||
url := fmt.Sprintf("wss://%s:%d/ticket/%s", host, port, ticket.Ticket)
|
||||
ret.Add(jsonutils.NewString("wmks"), "protocol")
|
||||
@@ -205,4 +204,4 @@ func (self *SVirtualMachine) acquireVmrcUrl() (jsonutils.JSONObject, error) {
|
||||
url := fmt.Sprintf("vmrc://clone:%s@%s:%d/?moid=%s", ticket, self.manager.host, port, self.GetId())
|
||||
ret.Add(jsonutils.NewString(url), "url")
|
||||
return ret, nil
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
package printutils
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"reflect"
|
||||
"strings"
|
||||
"fmt"
|
||||
|
||||
"github.com/yunionio/jsonutils"
|
||||
"github.com/yunionio/pkg/utils"
|
||||
"github.com/yunionio/onecloud/pkg/mcclient/modules"
|
||||
"github.com/yunionio/pkg/utils"
|
||||
)
|
||||
|
||||
func getter2json(obj interface{}) jsonutils.JSONObject {
|
||||
@@ -57,4 +57,4 @@ func PrintGetterList(data interface{}, columns []string) {
|
||||
|
||||
func PrintGetterObject(obj interface{}) {
|
||||
PrintJSONObject(getter2json(obj))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user