host

package
v1.0.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 2, 2020 License: Apache-2.0 Imports: 30 Imported by: 0

Documentation

Overview

Package host is a generated GoMock package.

Package host is a generated GoMock package.

Index

Constants

View Source
const (
	HostStatusDiscovering                 = "discovering"
	HostStatusKnown                       = "known"
	HostStatusDisconnected                = "disconnected"
	HostStatusInsufficient                = "insufficient"
	HostStatusDisabled                    = "disabled"
	HostStatusInstalling                  = "installing"
	HostStatusInstallingInProgress        = "installing-in-progress"
	HostStatusInstallingPendingUserAction = "installing-pending-user-action"
	HostStatusInstalled                   = "installed"
	HostStatusError                       = "error"
	HostStatusResetting                   = "resetting"
	HostStatusPendingForInput             = "pending-for-input"
)
View Source
const (
	TransitionTypeRegisterHost               = "RegisterHost"
	TransitionTypeHostInstallationFailed     = "HostInstallationFailed"
	TransitionTypeCancelInstallation         = "CancelInstallation"
	TransitionTypeResetHost                  = "ResetHost"
	TransitionTypeInstallHost                = "InstallHost"
	TransitionTypeDisableHost                = "DisableHost"
	TransitionTypeEnableHost                 = "EnableHost"
	TransitionTypeResettingPendingUserAction = "ResettingPendingUserAction"
	TransitionTypePrepareForInstallation     = "Prepare for installation"
	TransitionTypeRefresh                    = "RefreshHost"
)
View Source
const (
	IsConnected          = validationID(models.HostValidationIDConnected)
	HasInventory         = validationID(models.HostValidationIDHasInventory)
	IsMachineCidrDefined = validationID(models.HostValidationIDMachineCidrDefined)
	BelongsToMachineCidr = validationID(models.HostValidationIDBelongsToMachineCidr)
	HasMinCPUCores       = validationID(models.HostValidationIDHasMinCPUCores)
	HasMinValidDisks     = validationID(models.HostValidationIDHasMinValidDisks)
	HasMinMemory         = validationID(models.HostValidationIDHasMinMemory)
	HasCPUCoresForRole   = validationID(models.HostValidationIDHasCPUCoresForRole)
	HasMemoryForRole     = validationID(models.HostValidationIDHasMemoryForRole)
	IsHostnameUnique     = validationID(models.HostValidationIDHostnameUnique)
	IsRoleDefined        = validationID(models.HostValidationIDRoleDefined)
	IsHostnameValid      = validationID(models.HostValidationIDHostnameValid)
)
View Source
const (
	ValidationSuccess validationStatus = "success"
	ValidationFailure validationStatus = "failure"
	ValidationPending validationStatus = "pending"
	ValidationError   validationStatus = "error"
)

Variables

Functions

func If added in v1.0.7

func If(id validationID) stateswitch.Condition

func NewConnectivityCheckCmd

func NewConnectivityCheckCmd(log logrus.FieldLogger, db *gorm.DB, connectivityValidator connectivity.Validator, connectivityCheckImage string) *connectivityCheckCmd

func NewFreeAddressesCmd added in v1.0.2

func NewFreeAddressesCmd(log logrus.FieldLogger, freeAddressesImage string) *freeAddressesCmd

func NewHostStateMachine

func NewHostStateMachine(th *transitionHandler) stateswitch.StateMachine

func NewInstallCmd

func NewInstallCmd(log logrus.FieldLogger, db *gorm.DB, hwValidator hardware.Validator, instructionConfig InstructionConfig) *installCmd

func NewInventoryCmd

func NewInventoryCmd(log logrus.FieldLogger, inventoryImage string) *inventoryCmd

func NewResetInstallationCmd added in v1.0.5

func NewResetInstallationCmd(log logrus.FieldLogger) *resetInstallationCmd

func NewStopInstallationCmd added in v1.0.5

func NewStopInstallationCmd(log logrus.FieldLogger) *stopInstallationCmd

func UpdateHost added in v1.0.7

func UpdateHost(log logrus.FieldLogger, db *gorm.DB, clusterId strfmt.UUID, hostId strfmt.UUID,
	srcStatus string, extra ...interface{}) (*models.Host, error)

Types

type API

type API interface {
	// Register a new host
	RegisterHost(ctx context.Context, h *models.Host) error
	HandleInstallationFailure(ctx context.Context, h *models.Host) error
	InstructionApi
	UpdateInstallProgress(ctx context.Context, h *models.Host, progress *models.HostProgress) error
	RefreshStatus(ctx context.Context, h *models.Host, db *gorm.DB) error
	SetBootstrap(ctx context.Context, h *models.Host, isbootstrap bool, db *gorm.DB) error
	UpdateConnectivityReport(ctx context.Context, h *models.Host, connectivityReport string) error
	HostMonitoring()
	UpdateRole(ctx context.Context, h *models.Host, role models.HostRole, db *gorm.DB) error
	UpdateHostname(ctx context.Context, h *models.Host, hostname string, db *gorm.DB) error
	CancelInstallation(ctx context.Context, h *models.Host, reason string, db *gorm.DB) *common.ApiErrorResponse
	IsRequireUserActionReset(h *models.Host) bool
	ResetHost(ctx context.Context, h *models.Host, reason string, db *gorm.DB) *common.ApiErrorResponse
	ResetPendingUserAction(ctx context.Context, h *models.Host, db *gorm.DB) error
	// Disable host from getting any requests
	DisableHost(ctx context.Context, h *models.Host) error
	// Enable host to get requests (disabled by default)
	EnableHost(ctx context.Context, h *models.Host) error
	// Install host - db is optional, for transactions
	Install(ctx context.Context, h *models.Host, db *gorm.DB) error
	// Set a new inventory information
	UpdateInventory(ctx context.Context, h *models.Host, inventory string) error
	GetStagesByRole(role models.HostRole, isbootstrap bool) []models.HostStage
	IsInstallable(h *models.Host) bool
	PrepareForInstallation(ctx context.Context, h *models.Host, db *gorm.DB) error
}

type CommandGetter

type CommandGetter interface {
	GetStep(ctx context.Context, host *models.Host) (*models.Step, error)
}

type InstructionApi

type InstructionApi interface {
	GetNextSteps(ctx context.Context, host *models.Host) (models.Steps, error)
}

type InstructionConfig

type InstructionConfig struct {
	InventoryURL           string `envconfig:"INVENTORY_URL" default:"10.35.59.36"`
	InventoryPort          string `envconfig:"INVENTORY_PORT" default:"30485"`
	InstallerImage         string `envconfig:"INSTALLER_IMAGE" default:"quay.io/ocpmetal/assisted-installer:latest"`
	ControllerImage        string `envconfig:"CONTROLLER_IMAGE" default:"quay.io/ocpmetal/assisted-installer-controller:latest"`
	ConnectivityCheckImage string `envconfig:"CONNECTIVITY_CHECK_IMAGE" default:"quay.io/ocpmetal/connectivity_check:latest"`
	InventoryImage         string `envconfig:"INVENTORY_IMAGE" default:"quay.io/ocpmetal/inventory:latest"`
	FreeAddressesImage     string `envconfig:"FREE_ADDRESSES_IMAGE" default:"quay.io/ocpmetal/free_addresses:latest"`
}

type InstructionManager

type InstructionManager struct {
	// contains filtered or unexported fields
}

func NewInstructionManager

func NewInstructionManager(log logrus.FieldLogger, db *gorm.DB, hwValidator hardware.Validator, instructionConfig InstructionConfig, connectivityValidator connectivity.Validator) *InstructionManager

func (*InstructionManager) GetNextSteps

func (i *InstructionManager) GetNextSteps(ctx context.Context, host *models.Host) (models.Steps, error)

type Manager

type Manager struct {
	// contains filtered or unexported fields
}

func NewManager

func NewManager(log logrus.FieldLogger, db *gorm.DB, eventsHandler events.Handler, hwValidator hardware.Validator, instructionApi InstructionApi,
	hwValidatorCfg *hardware.ValidatorCfg, metricApi metrics.API) *Manager

func (*Manager) CancelInstallation added in v1.0.4

func (m *Manager) CancelInstallation(ctx context.Context, h *models.Host, reason string, db *gorm.DB) *common.ApiErrorResponse

func (*Manager) DisableHost

func (m *Manager) DisableHost(ctx context.Context, h *models.Host) error

func (*Manager) EnableHost

func (m *Manager) EnableHost(ctx context.Context, h *models.Host) error

func (*Manager) GetNextSteps

func (m *Manager) GetNextSteps(ctx context.Context, host *models.Host) (models.Steps, error)

func (*Manager) GetStagesByRole added in v1.0.5

func (m *Manager) GetStagesByRole(role models.HostRole, isbootstrap bool) []models.HostStage

func (*Manager) HandleInstallationFailure

func (m *Manager) HandleInstallationFailure(ctx context.Context, h *models.Host) error

func (*Manager) HostMonitoring

func (m *Manager) HostMonitoring()

func (*Manager) Install

func (m *Manager) Install(ctx context.Context, h *models.Host, db *gorm.DB) error

func (*Manager) IsInstallable added in v1.0.5

func (m *Manager) IsInstallable(h *models.Host) bool

func (*Manager) IsRequireUserActionReset added in v1.0.5

func (m *Manager) IsRequireUserActionReset(h *models.Host) bool

func (*Manager) PrepareForInstallation added in v1.0.7

func (m *Manager) PrepareForInstallation(ctx context.Context, h *models.Host, db *gorm.DB) error

func (*Manager) RefreshStatus

func (m *Manager) RefreshStatus(ctx context.Context, h *models.Host, db *gorm.DB) error

func (*Manager) RegisterHost

func (m *Manager) RegisterHost(ctx context.Context, h *models.Host) error

func (*Manager) ResetHost added in v1.0.4

func (m *Manager) ResetHost(ctx context.Context, h *models.Host, reason string, db *gorm.DB) *common.ApiErrorResponse

func (*Manager) ResetPendingUserAction added in v1.0.5

func (m *Manager) ResetPendingUserAction(ctx context.Context, h *models.Host, db *gorm.DB) error

func (*Manager) SetBootstrap

func (m *Manager) SetBootstrap(ctx context.Context, h *models.Host, isbootstrap bool, db *gorm.DB) error

func (*Manager) UpdateConnectivityReport

func (m *Manager) UpdateConnectivityReport(ctx context.Context, h *models.Host, connectivityReport string) error

func (*Manager) UpdateHostname added in v1.0.5

func (m *Manager) UpdateHostname(ctx context.Context, h *models.Host, hostname string, db *gorm.DB) error

func (*Manager) UpdateInstallProgress

func (m *Manager) UpdateInstallProgress(ctx context.Context, h *models.Host, progress *models.HostProgress) error

func (*Manager) UpdateInventory

func (m *Manager) UpdateInventory(ctx context.Context, h *models.Host, inventory string) error

func (*Manager) UpdateRole

func (m *Manager) UpdateRole(ctx context.Context, h *models.Host, role models.HostRole, db *gorm.DB) error

type MockAPI

type MockAPI struct {
	// contains filtered or unexported fields
}

MockAPI is a mock of API interface

func NewMockAPI

func NewMockAPI(ctrl *gomock.Controller) *MockAPI

NewMockAPI creates a new mock instance

func (*MockAPI) CancelInstallation added in v1.0.4

func (m *MockAPI) CancelInstallation(ctx context.Context, h *models.Host, reason string, db *gorm.DB) *common.ApiErrorResponse

CancelInstallation mocks base method

func (*MockAPI) DisableHost

func (m *MockAPI) DisableHost(ctx context.Context, h *models.Host) error

DisableHost mocks base method

func (*MockAPI) EXPECT

func (m *MockAPI) EXPECT() *MockAPIMockRecorder

EXPECT returns an object that allows the caller to indicate expected use

func (*MockAPI) EnableHost

func (m *MockAPI) EnableHost(ctx context.Context, h *models.Host) error

EnableHost mocks base method

func (*MockAPI) GetHostname added in v1.0.4

func (m *MockAPI) GetHostname(h *models.Host) string

GetHostname mocks base method

func (*MockAPI) GetNextSteps

func (m *MockAPI) GetNextSteps(ctx context.Context, host *models.Host) (models.Steps, error)

GetNextSteps mocks base method

func (*MockAPI) GetStagesByRole added in v1.0.5

func (m *MockAPI) GetStagesByRole(role models.HostRole, isbootstrap bool) []models.HostStage

GetStagesByRole mocks base method

func (*MockAPI) HandleInstallationFailure

func (m *MockAPI) HandleInstallationFailure(ctx context.Context, h *models.Host) error

HandleInstallationFailure mocks base method

func (*MockAPI) HostMonitoring

func (m *MockAPI) HostMonitoring()

HostMonitoring mocks base method

func (*MockAPI) Install

func (m *MockAPI) Install(ctx context.Context, h *models.Host, db *gorm.DB) error

Install mocks base method

func (*MockAPI) IsInstallable added in v1.0.5

func (m *MockAPI) IsInstallable(h *models.Host) bool

IsInstallable mocks base method

func (*MockAPI) IsRequireUserActionReset added in v1.0.5

func (m *MockAPI) IsRequireUserActionReset(h *models.Host) bool

IsRequireUserActionReset mocks base method

func (*MockAPI) PrepareForInstallation added in v1.0.7

func (m *MockAPI) PrepareForInstallation(ctx context.Context, h *models.Host, db *gorm.DB) error

PrepareForInstallation mocks base method

func (*MockAPI) RefreshStatus

func (m *MockAPI) RefreshStatus(ctx context.Context, h *models.Host, db *gorm.DB) error

RefreshStatus mocks base method

func (*MockAPI) RegisterHost

func (m *MockAPI) RegisterHost(ctx context.Context, h *models.Host) error

RegisterHost mocks base method

func (*MockAPI) ResetHost added in v1.0.4

func (m *MockAPI) ResetHost(ctx context.Context, h *models.Host, reason string, db *gorm.DB) *common.ApiErrorResponse

ResetHost mocks base method

func (*MockAPI) ResetPendingUserAction added in v1.0.5

func (m *MockAPI) ResetPendingUserAction(ctx context.Context, h *models.Host, db *gorm.DB) error

ResetPendingUserAction mocks base method

func (*MockAPI) SetBootstrap

func (m *MockAPI) SetBootstrap(ctx context.Context, h *models.Host, isbootstrap bool, db *gorm.DB) error

SetBootstrap mocks base method

func (*MockAPI) UpdateConnectivityReport

func (m *MockAPI) UpdateConnectivityReport(ctx context.Context, h *models.Host, connectivityReport string) error

UpdateConnectivityReport mocks base method

func (*MockAPI) UpdateHostname added in v1.0.5

func (m *MockAPI) UpdateHostname(ctx context.Context, h *models.Host, hostname string, db *gorm.DB) error

UpdateHostname mocks base method

func (*MockAPI) UpdateInstallProgress

func (m *MockAPI) UpdateInstallProgress(ctx context.Context, h *models.Host, progress *models.HostProgress) error

UpdateInstallProgress mocks base method

func (*MockAPI) UpdateInventory

func (m *MockAPI) UpdateInventory(ctx context.Context, h *models.Host, inventory string) error

UpdateInventory mocks base method

func (*MockAPI) UpdateRole

func (m *MockAPI) UpdateRole(ctx context.Context, h *models.Host, role models.HostRole, db *gorm.DB) error

UpdateRole mocks base method

type MockAPIMockRecorder

type MockAPIMockRecorder struct {
	// contains filtered or unexported fields
}

MockAPIMockRecorder is the mock recorder for MockAPI

func (*MockAPIMockRecorder) CancelInstallation added in v1.0.4

func (mr *MockAPIMockRecorder) CancelInstallation(ctx, h, reason, db interface{}) *gomock.Call

CancelInstallation indicates an expected call of CancelInstallation

func (*MockAPIMockRecorder) DisableHost

func (mr *MockAPIMockRecorder) DisableHost(ctx, h interface{}) *gomock.Call

DisableHost indicates an expected call of DisableHost

func (*MockAPIMockRecorder) EnableHost

func (mr *MockAPIMockRecorder) EnableHost(ctx, h interface{}) *gomock.Call

EnableHost indicates an expected call of EnableHost

func (*MockAPIMockRecorder) GetHostname added in v1.0.4

func (mr *MockAPIMockRecorder) GetHostname(h interface{}) *gomock.Call

GetHostname indicates an expected call of GetHostname

func (*MockAPIMockRecorder) GetNextSteps

func (mr *MockAPIMockRecorder) GetNextSteps(ctx, host interface{}) *gomock.Call

GetNextSteps indicates an expected call of GetNextSteps

func (*MockAPIMockRecorder) GetStagesByRole added in v1.0.5

func (mr *MockAPIMockRecorder) GetStagesByRole(role, isbootstrap interface{}) *gomock.Call

GetStagesByRole indicates an expected call of GetStagesByRole

func (*MockAPIMockRecorder) HandleInstallationFailure

func (mr *MockAPIMockRecorder) HandleInstallationFailure(ctx, h interface{}) *gomock.Call

HandleInstallationFailure indicates an expected call of HandleInstallationFailure

func (*MockAPIMockRecorder) HostMonitoring

func (mr *MockAPIMockRecorder) HostMonitoring() *gomock.Call

HostMonitoring indicates an expected call of HostMonitoring

func (*MockAPIMockRecorder) Install

func (mr *MockAPIMockRecorder) Install(ctx, h, db interface{}) *gomock.Call

Install indicates an expected call of Install

func (*MockAPIMockRecorder) IsInstallable added in v1.0.5

func (mr *MockAPIMockRecorder) IsInstallable(h interface{}) *gomock.Call

IsInstallable indicates an expected call of IsInstallable

func (*MockAPIMockRecorder) IsRequireUserActionReset added in v1.0.5

func (mr *MockAPIMockRecorder) IsRequireUserActionReset(h interface{}) *gomock.Call

IsRequireUserActionReset indicates an expected call of IsRequireUserActionReset

func (*MockAPIMockRecorder) PrepareForInstallation added in v1.0.7

func (mr *MockAPIMockRecorder) PrepareForInstallation(ctx, h, db interface{}) *gomock.Call

PrepareForInstallation indicates an expected call of PrepareForInstallation

func (*MockAPIMockRecorder) RefreshStatus

func (mr *MockAPIMockRecorder) RefreshStatus(ctx, h, db interface{}) *gomock.Call

RefreshStatus indicates an expected call of RefreshStatus

func (*MockAPIMockRecorder) RegisterHost

func (mr *MockAPIMockRecorder) RegisterHost(ctx, h interface{}) *gomock.Call

RegisterHost indicates an expected call of RegisterHost

func (*MockAPIMockRecorder) ResetHost added in v1.0.4

func (mr *MockAPIMockRecorder) ResetHost(ctx, h, reason, db interface{}) *gomock.Call

ResetHost indicates an expected call of ResetHost

func (*MockAPIMockRecorder) ResetPendingUserAction added in v1.0.5

func (mr *MockAPIMockRecorder) ResetPendingUserAction(ctx, h, db interface{}) *gomock.Call

ResetPendingUserAction indicates an expected call of ResetPendingUserAction

func (*MockAPIMockRecorder) SetBootstrap

func (mr *MockAPIMockRecorder) SetBootstrap(ctx, h, isbootstrap, db interface{}) *gomock.Call

SetBootstrap indicates an expected call of SetBootstrap

func (*MockAPIMockRecorder) UpdateConnectivityReport

func (mr *MockAPIMockRecorder) UpdateConnectivityReport(ctx, h, connectivityReport interface{}) *gomock.Call

UpdateConnectivityReport indicates an expected call of UpdateConnectivityReport

func (*MockAPIMockRecorder) UpdateHostname added in v1.0.5

func (mr *MockAPIMockRecorder) UpdateHostname(ctx, h, hostname, db interface{}) *gomock.Call

UpdateHostname indicates an expected call of UpdateHostname

func (*MockAPIMockRecorder) UpdateInstallProgress

func (mr *MockAPIMockRecorder) UpdateInstallProgress(ctx, h, progress interface{}) *gomock.Call

UpdateInstallProgress indicates an expected call of UpdateInstallProgress

func (*MockAPIMockRecorder) UpdateInventory

func (mr *MockAPIMockRecorder) UpdateInventory(ctx, h, inventory interface{}) *gomock.Call

UpdateInventory indicates an expected call of UpdateInventory

func (*MockAPIMockRecorder) UpdateRole

func (mr *MockAPIMockRecorder) UpdateRole(ctx, h, role, db interface{}) *gomock.Call

UpdateRole indicates an expected call of UpdateRole

type MockInstructionApi

type MockInstructionApi struct {
	// contains filtered or unexported fields
}

MockInstructionApi is a mock of InstructionApi interface

func NewMockInstructionApi

func NewMockInstructionApi(ctrl *gomock.Controller) *MockInstructionApi

NewMockInstructionApi creates a new mock instance

func (*MockInstructionApi) EXPECT

EXPECT returns an object that allows the caller to indicate expected use

func (*MockInstructionApi) GetNextSteps

func (m *MockInstructionApi) GetNextSteps(ctx context.Context, host *models.Host) (models.Steps, error)

GetNextSteps mocks base method

type MockInstructionApiMockRecorder

type MockInstructionApiMockRecorder struct {
	// contains filtered or unexported fields
}

MockInstructionApiMockRecorder is the mock recorder for MockInstructionApi

func (*MockInstructionApiMockRecorder) GetNextSteps

func (mr *MockInstructionApiMockRecorder) GetNextSteps(ctx, host interface{}) *gomock.Call

GetNextSteps indicates an expected call of GetNextSteps

type StepsStruct added in v1.0.2

type StepsStruct struct {
	Commands      []CommandGetter
	NextStepInSec int64
}

type TransitionArgsCancelInstallation added in v1.0.4

type TransitionArgsCancelInstallation struct {
	// contains filtered or unexported fields
}

type TransitionArgsDisableHost added in v1.0.5

type TransitionArgsDisableHost struct {
	// contains filtered or unexported fields
}

type TransitionArgsEnableHost added in v1.0.5

type TransitionArgsEnableHost struct {
	// contains filtered or unexported fields
}

type TransitionArgsHostInstallationFailed

type TransitionArgsHostInstallationFailed struct {
	// contains filtered or unexported fields
}

type TransitionArgsInstallHost added in v1.0.5

type TransitionArgsInstallHost struct {
	// contains filtered or unexported fields
}

type TransitionArgsPrepareForInstallation added in v1.0.7

type TransitionArgsPrepareForInstallation struct {
	// contains filtered or unexported fields
}

type TransitionArgsRefreshHost added in v1.0.7

type TransitionArgsRefreshHost struct {
	// contains filtered or unexported fields
}

type TransitionArgsRegisterHost

type TransitionArgsRegisterHost struct {
	// contains filtered or unexported fields
}

type TransitionArgsResetHost added in v1.0.4

type TransitionArgsResetHost struct {
	// contains filtered or unexported fields
}

type TransitionResettingPendingUserAction added in v1.0.5

type TransitionResettingPendingUserAction struct {
	// contains filtered or unexported fields
}

type UpdateReply

type UpdateReply struct {
	State     string
	IsChanged bool
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL