modelsext

package
v0.0.0-...-9649b88 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2020 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var BuildIaasPort = func(portObj *portobj.PortObj) *iaasaccessor.Interface {
	iaasPort := iaasaccessor.Interface{}
	iaasPort.NetPlaneName = portObj.EagerAttr.NetworkName
	iaasPort.NetPlane = portObj.EagerAttr.NetworkPlane
	iaasPort.Name = portObj.EagerAttr.PortName
	iaasPort.NicType = portObj.EagerAttr.VnicType
	iaasPort.PodNs = portObj.EagerAttr.PodNs
	iaasPort.TenantID = portObj.EagerAttr.PodNs
	iaasPort.PodName = portObj.EagerAttr.PodName
	iaasPort.Accelerate = portObj.EagerAttr.Accelerate
	iaasPort.Id = portObj.LazyAttr.ID
	iaasPort.NetworkId = portObj.LazyAttr.NetAttr.ID
	iaasPort.BusInfos = portObj.LazyAttr.BusInfos
	iaasPort.OrgDriver = portObj.LazyAttr.OrgDriver
	return &iaasPort
}
View Source
var BuildIaasPorts = func(portObjs []*portobj.PortObj) []*iaasaccessor.Interface {
	iaasPorts := make([]*iaasaccessor.Interface, 0)
	for _, portObj := range portObjs {
		iaasPorts = append(iaasPorts, BuildIaasPort(portObj))
	}
	return iaasPorts
}
View Source
var DeletePortFromEtcd = func(agtObj *cni.AgentContext, port iaasaccessor.Interface) error {
	interfaceID := port.Id + port.PodNs + port.PodName
	keyOfInterfaceInNetwork := dbaccessor.GetKeyOfInterfaceInNetwork(port.TenantID, port.NetworkId, interfaceID)
	err3 := agtObj.RemoteDB.DeleteLeaf(keyOfInterfaceInNetwork)
	if err3 != nil {
		klog.Errorf("deletePortFromEtcd: agtObj.RemoteDB.DeleteLeaf(urlInterfaceInNetwork) error! -%v", err3)
	}
	keyOfInterface := dbaccessor.GetKeyOfInterface(port.TenantID, interfaceID)
	err5 := agtObj.RemoteDB.DeleteDir(keyOfInterface)
	if err5 != nil {
		klog.Errorf("deletePortFromEtcd:  agtObj.RemoteDB.DeleteDir(portSelf) error! -%v", err5)
	}
	urlPaasInterfaceForNode := dbaccessor.GetKeyOfPaasInterfaceForNode(agtObj.ClusterID, agtObj.HostIP, interfaceID)
	err6 := agtObj.RemoteDB.DeleteLeaf(urlPaasInterfaceForNode)
	if err6 != nil {
		klog.Errorf("deletePortFromEtcd: agtObj.RemoteDB.DeleteLeaf(urlPaasInterfaceForNode) error! -%v", err6)
	}

	if port.NetPlane == "eio" {
		urlIaasEioInterfaceForNode := dbaccessor.GetKeyOfIaasEioInterfaceForNode(agtObj.ClusterID, agtObj.HostIP, port.Id)
		err7 := agtObj.RemoteDB.DeleteLeaf(urlIaasEioInterfaceForNode)
		if err7 != nil {
			klog.Errorf("deletePortFromEtcd: agtObj.RemoteDB.DeleteLeaf(urlIaasEioInterfaceForNode) error! -%v", err7)
		}
	}
	keyPortInPod := dbaccessor.GetKeyOfInterfaceInPod(port.TenantID,
		port.Id, port.PodNs, port.PodName)
	klog.Infof("deletePortFromEtcd:GetKeyOfInterfaceInPod:", keyPortInPod)
	err8 := agtObj.RemoteDB.DeleteLeaf(keyPortInPod)
	if err8 != nil {
		klog.Errorf("deletePortFromEtcd: agtObj.RemoteDB.DeleteLeaf keyPortInPod error! -%v", err8)
	}
	return nil
}
View Source
var DeletePortFromLocalDB = func(agtObj *cni.AgentContext, port iaasaccessor.Interface) error {
	interfaceID := port.Id + port.PodNs + port.PodName
	keyOfInterfaceInNetwork := dbaccessor.GetKeyOfInterfaceInNetwork(port.TenantID, port.NetworkId, interfaceID)
	err3 := agtObj.DB.DeleteLeaf(keyOfInterfaceInNetwork)
	if err3 != nil {
		klog.Errorf("DeletePortFromLocalDB: agtObj.DB.DeleteLeaf(urlInterfaceInNetwork) error! -%v", err3)
	}
	keyOfInterface := dbaccessor.GetKeyOfInterface(port.TenantID, interfaceID)
	err5 := agtObj.DB.DeleteDir(keyOfInterface)
	if err5 != nil {
		klog.Errorf("DeletePortFromLocalDB:  agtObj.DB.DeleteDir(portSelf) error! -%v", err5)
	}
	urlPaasInterfaceForNode := dbaccessor.GetKeyOfPaasInterfaceForNode(agtObj.ClusterID, agtObj.HostIP, interfaceID)
	err6 := agtObj.DB.DeleteLeaf(urlPaasInterfaceForNode)
	if err6 != nil {
		klog.Errorf("DeletePortFromLocalDB: agtObj.DB.DeleteLeaf(urlPaasInterfaceForNode) error! -%v", err6)
	}

	if port.NetPlane == "eio" {
		urlIaasEioInterfaceForNode := dbaccessor.GetKeyOfIaasEioInterfaceForNode(agtObj.ClusterID, agtObj.HostIP, port.Id)
		err7 := agtObj.DB.DeleteLeaf(urlIaasEioInterfaceForNode)
		if err7 != nil {
			klog.Errorf("DeletePortFromLocalDB: agtObj.DB.DeleteLeaf(urlIaasEioInterfaceForNode) error! -%v", err7)
		}
	}
	keyPortInPod := dbaccessor.GetKeyOfInterfaceInPod(port.TenantID,
		port.Id, port.PodNs, port.PodName)
	klog.Infof("DeletePortFromLocalDB:GetKeyOfInterfaceInPod:", keyPortInPod)
	err8 := agtObj.DB.DeleteLeaf(keyPortInPod)
	if err8 != nil {
		klog.Errorf("DeletePortFromLocalDB: DeleteLeaf keyPortInPod error! -%v", err8)
	}
	return nil
}

Functions

func DeletePodFromEtcd

func DeletePodFromEtcd(agtObj *cni.AgentContext, cniObj *cni.CniParam) error

func DeletePodFromLocalDB

func DeletePodFromLocalDB(agtObj *cni.AgentContext, cniObj *cni.CniParam) error

Types

This section is empty.

Jump to

Keyboard shortcuts

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