one

package
v0.0.0-r7 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2022 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Overview

Copyright © 2021-2022 Nikita Ivanovski info@slnt-opp.xyz

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.

Copyright © 2021-2022 Nikita Ivanovski info@slnt-opp.xyz

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.

Copyright © 2021-2022 Nikita Ivanovski info@slnt-opp.xyz

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.

Copyright © 2021-2022 Nikita Ivanovski info@slnt-opp.xyz

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.

Copyright © 2021-2022 Nikita Ivanovski info@slnt-opp.xyz

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.

Copyright © 2021-2022 Nikita Ivanovski info@slnt-opp.xyz

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.

Copyright © 2021-2022 Nikita Ivanovski info@slnt-opp.xyz

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.

Copyright © 2021-2022 Nikita Ivanovski info@slnt-opp.xyz

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.

Copyright © 2021-2022 Nikita Ivanovski info@slnt-opp.xyz

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.

Index

Constants

This section is empty.

Variables

View Source
var (
	// OpenNebula Scheduler Requirements (nodes provisioning rules for VMs deploy)
	SCHED = "sched"
	// OpenNebula DataStore Scheduler Requirements (datastores provisioning rules for VMs deploy)
	SCHED_DS = "sched_ds"
	// OpenNebula Super VNet public IP addresses to be reserved from
	PUBLIC_IP_POOL = "public_ip_pool"
	// OpenNebula Super VNet private IP addresses to be reserved from
	PRIVATE_VN_TEMPLATE = "private_vnet_tmpl"

	// OpenNebula VM Name Data Key
	DATA_VM_NAME = "vm_name"
	// OpenNebula VM ID Data Key
	DATA_VM_ID = "vmid"
)
View Source
var (
	USER_PUBLIC_VNET_NAME_PATTERN  = "user-%d-pub-vnet"
	USER_PRIVATE_VNET_NAME_PATTERN = "user-%d-private-vnet"
)
View Source
var VMMsRecordHelpers = map[string]func(state map[string]interface{}, rec dynamic.Template, host host.Host){
	"vcenter": vCenterRecordHelper,
}

Functions

func GetVMIDFromData

func GetVMIDFromData(client *ONeClient, inst *pb.Instance) (vmid int, err error)

func GetVarValue

func GetVarValue(in *proto.Var, key string) (r *structpb.Value, err error)

func MonitorDatastoresPool

func MonitorDatastoresPool(log *zap.Logger, c *ONeClient) (res *structpb.Value, err error)

func MonitorHostsPool

func MonitorHostsPool(log *zap.Logger, c *ONeClient) (res *structpb.Value, err error)

func MonitorNetworks

func MonitorNetworks(log *zap.Logger, c *ONeClient) (res *structpb.Value, err error)

func MonitorTemplates

func MonitorTemplates(log *zap.Logger, c *ONeClient) (res *structpb.Value, err error)

Types

type CheckInstancesGroupResponse

type CheckInstancesGroupResponse struct {
	ToBeCreated []*pb.Instance
	ToBeDeleted []*pb.Instance
	ToBeUpdated []*pb.Instance
	Valid       []*pb.Instance
}

type LocationPublicData

type LocationPublicData struct {
	Uuid  string `json:"uuid"`
	Error string `json:"error"`

	PublicData map[string]*structpb.Value
}

type LocationState

type LocationState struct {
	Uuid  string            `json:"uuid"`
	State stpb.NoCloudState `json:"state"`
	Error string            `json:"error"`

	Meta map[string]*structpb.Value
}

type ONeClient

type ONeClient struct {
	*goca.Client
	// contains filtered or unexported fields
}

func NewClient

func NewClient(user, password, endpoint string, log *zap.Logger) *ONeClient

func NewClientFromSP

func NewClientFromSP(sp *sppb.ServicesProvider, log *zap.Logger) (*ONeClient, error)

func (*ONeClient) CheckInstancesGroup

func (c *ONeClient) CheckInstancesGroup(IG *pb.InstancesGroup) (*CheckInstancesGroupResponse, error)

func (*ONeClient) CheckInstancesGroupResponseProcess

func (c *ONeClient) CheckInstancesGroupResponseProcess(resp *CheckInstancesGroupResponse, data map[string]*structpb.Value, group int)

func (*ONeClient) Chmod

func (c *ONeClient) Chmod(class string, oid int, perm *shared.Permissions) error

Chmod common method

class - shorthand for entity type, possible values:
	vm - VirtualMachine,
	vn - VirtualNetwork,
	template - VM Template,
	image - Image,
	datastore - DataStore

func (*ONeClient) Chown

func (c *ONeClient) Chown(class string, oid, uid, gid int) error

Chown common method

class - shorthand for entity type, possible values:
	vm - VirtualMachine,
	vn - VirtualNetwork,
	template - VM Template,
	image - Image,
	datastore - DataStore

func (*ONeClient) CreateUser

func (c *ONeClient) CreateUser(name, pass string, groups []int) (id int, err error)

func (*ONeClient) DeleteUser

func (c *ONeClient) DeleteUser(id int) error

func (*ONeClient) DeleteUserAndVNets

func (c *ONeClient) DeleteUserAndVNets(id int) error

func (*ONeClient) DeleteVNet

func (c *ONeClient) DeleteVNet(id int) error

func (*ONeClient) FindFreeVlan

func (c *ONeClient) FindFreeVlan(sp *sppb.ServicesProvider) (vnMad string, freeVlan int, err error)

func (*ONeClient) FindVMByInstance

func (c *ONeClient) FindVMByInstance(inst *pb.Instance) (*vm.VM, error)

func (*ONeClient) GetGroup

func (c *ONeClient) GetGroup(id int) (*group.Group, error)

func (*ONeClient) GetImage

func (c *ONeClient) GetImage(id int) (*img.Image, error)

func (*ONeClient) GetInstSnapshots

func (c *ONeClient) GetInstSnapshots(inst *pb.Instance) (map[string]interface{}, error)

func (*ONeClient) GetSecrets

func (c *ONeClient) GetSecrets() map[string]*structpb.Value

func (*ONeClient) GetTemplate

func (c *ONeClient) GetTemplate(id int) (*tmpl.Template, error)

func (*ONeClient) GetUser

func (c *ONeClient) GetUser(id int) (*user.User, error)

func (*ONeClient) GetUserPrivateVNet

func (c *ONeClient) GetUserPrivateVNet(user int) (id int, err error)

func (*ONeClient) GetUserPublicVNet

func (c *ONeClient) GetUserPublicVNet(user int) (id int, err error)

func (*ONeClient) GetUserVMsInstancesGroup

func (c *ONeClient) GetUserVMsInstancesGroup(userId int) (*pb.InstancesGroup, error)

returns instances of all VMs belonged to User

func (*ONeClient) GetVM

func (c *ONeClient) GetVM(vmid int) (*vm.VM, error)

func (*ONeClient) GetVMByName

func (c *ONeClient) GetVMByName(name string) (id int, err error)

func (*ONeClient) GetVNet

func (c *ONeClient) GetVNet(id int) (*vnet.VirtualNetwork, error)

func (*ONeClient) InstantiateTemplate

func (c *ONeClient) InstantiateTemplate(id int, vmname, tmpl string, pending bool) (vmid int, err error)

func (*ONeClient) InstantiateTemplateHelper

func (c *ONeClient) InstantiateTemplateHelper(instance *instpb.Instance, group_data map[string]*structpb.Value, token string) (vmid int, err error)

func (*ONeClient) ListImages

func (c *ONeClient) ListImages() ([]img.Image, error)

func (*ONeClient) ListTemplates

func (c *ONeClient) ListTemplates() ([]tmpl.Template, error)

func (*ONeClient) Logger

func (c *ONeClient) Logger(n string) *zap.Logger

func (*ONeClient) MonitorLocation

func (c *ONeClient) MonitorLocation(sp *sppb.ServicesProvider) (st *LocationState, pd *LocationPublicData, err error)

func (*ONeClient) NetworkingVM

func (c *ONeClient) NetworkingVM(id int) (map[string]interface{}, error)

func (*ONeClient) PoweroffVM

func (c *ONeClient) PoweroffVM(id int, hard bool) error

func (*ONeClient) RebootVM

func (c *ONeClient) RebootVM(id int, hard bool) error

func (*ONeClient) ReservePrivateIP

func (c *ONeClient) ReservePrivateIP(u int, vnMad string, vlanID int) (pool_id int, err error)

func (*ONeClient) ReservePublicIP

func (c *ONeClient) ReservePublicIP(u, n int) (pool_id int, err error)

func (*ONeClient) ReserveVNet

func (c *ONeClient) ReserveVNet(id, size, to int, name string) (int, error)

Reserve Addresses to the other VNet

id - VNet ID to reserve from
size - amount of addresses to reserve
to - VNet ID to reserve to, if set to -1 new will be created
name - name of the new VNet, if set to "", either existing will be used or new - generated

func (*ONeClient) ResumeVM

func (c *ONeClient) ResumeVM(id int) error

func (*ONeClient) SetSecrets

func (c *ONeClient) SetSecrets(secrets map[string]*structpb.Value)

func (*ONeClient) SetVars

func (c *ONeClient) SetVars(vars map[string]*sppb.Var)

func (*ONeClient) SnapCreate

func (c *ONeClient) SnapCreate(name string, vmid int) error

func (*ONeClient) SnapDelete

func (c *ONeClient) SnapDelete(snapId, vmid int) error

func (*ONeClient) SnapRevert

func (c *ONeClient) SnapRevert(snapId, vmid int) error

func (*ONeClient) StateVM

func (c *ONeClient) StateVM(id int) (state int, state_str string, lcm_state int, lcm_state_str string, err error)

func (*ONeClient) SuspendVM

func (c *ONeClient) SuspendVM(id int) error

func (*ONeClient) TerminateVM

func (c *ONeClient) TerminateVM(id int, hard bool) error

func (*ONeClient) UpdateVNet

func (c *ONeClient) UpdateVNet(id int, tmpl string, uType parameters.UpdateType) error

func (*ONeClient) UserAddAttribute

func (c *ONeClient) UserAddAttribute(id int, data map[string]interface{}) error

func (*ONeClient) VMToInstance

func (c *ONeClient) VMToInstance(id int) (*pb.Instance, error)

type Record

type Record struct {
	Start int64
	End   int64

	State stpb.NoCloudState
}

func FilterTimeline

func FilterTimeline(tl []Record, from, to int64) (res []Record)

func MakeRecord

func MakeRecord(from, to int, state stpb.NoCloudState) (res Record)

func MakeTimeline

func MakeTimeline(vm *vm.VM) (res []Record)

func MakeTimelineRecords

func MakeTimelineRecords(r vm.HistoryRecord) (res []Record)

Jump to

Keyboard shortcuts

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