utils

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2021 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Overview

Copyright (c) 2019 Dell EMC Corporation All Rights Reserved

Index

Constants

View Source
const (
	UnityLogger = "unitylog"
	LogFields   = "fields"
	RUNID       = "runid"
	ARRAYID     = "arrayid"
)

Variables

This section is empty.

Functions

func ArrayContains

func ArrayContains(stringArray []string, value string) bool

ArrayContains method does contains check operation

func ArrayContainsAll

func ArrayContainsAll(stringArray1 []string, stringArray2 []string) bool

ArrayContainsAll method checks if all elements of stringArray1 is present in stringArray2

func ChangeLogLevel added in v1.6.0

func ChangeLogLevel(logLevel string)

func FindAdditionalWwns

func FindAdditionalWwns(stringArray1 []string, stringArray2 []string) []string

FindAdditionalWwns returns the set difference stringArray2-stringArray1

func GetFCInitiators

func GetFCInitiators(ctx context.Context) ([]string, error)

func GetFcPortWwnFromVolumeContentWwn

func GetFcPortWwnFromVolumeContentWwn(wwn string) string

GetWwnFromVolumeContentWwn - Method to process wwn content to extract device wwn of a volume

func GetHostIP

func GetHostIP() ([]string, error)

Utility method to extract Host IP

func GetIPsFromInferfaces

func GetIPsFromInferfaces(ctx context.Context, ipInterfaces []types.IPInterfaceEntries) []string

GetIPsFromInferfaces - Method to extract ip as string from ipInterface object

func GetLogger

func GetLogger() *logrus.Logger

func GetMessageWithRunID

func GetMessageWithRunID(runid string, format string, args ...interface{}) string

func GetRunidAndLogger

func GetRunidAndLogger(ctx context.Context) (string, *logrus.Entry)

func GetRunidLogger

func GetRunidLogger(ctx context.Context) *logrus.Entry

func GetSnapshotResponseFromSnapshot

func GetSnapshotResponseFromSnapshot(snap *types.Snapshot, protocol, arrayId string) *csi.CreateSnapshotResponse

Utility method to convert Unity Rest type Snapshot to CSI standard Snapshot Response

func GetVolumeResponseFromFilesystem

func GetVolumeResponseFromFilesystem(filesystem *types.Filesystem, arrayId, protocol string, preferredAccessibility []*csi.Topology) *csi.CreateVolumeResponse

GetVolumeResponseFromFilesystem Utility method to convert Unity rest Filesystem response to CSI standard Volume Response

func GetVolumeResponseFromSnapshot added in v1.3.0

func GetVolumeResponseFromSnapshot(snapshot *types.Snapshot, arrayId, protocol string, preferredAccessibility []*csi.Topology) *csi.CreateVolumeResponse

func GetVolumeResponseFromVolume

func GetVolumeResponseFromVolume(volume *types.Volume, arrayId, protocol string, preferredAccessibility []*csi.Topology) *csi.CreateVolumeResponse

GetVolumeResponseFromVolume Utility method to convert Unity Rest type Volume to CSI standard Volume Response

func GetWwnFromVolumeContentWwn

func GetWwnFromVolumeContentWwn(wwn string) string

GetWwnFromVolumeContentWwn - Method to process wwn content to extract device wwn of a volume

func IPReachable

func IPReachable(ctx context.Context, ip, port string, pingTimeout int) bool

IPReachable checks if a given IP is reachable or not

func IpsCompare

func IpsCompare(ctx context.Context, ip string, hostIps []string) (bool, []string)

IpsCompare checks if the given ip is present as IP or FQDN in the given list of host ips

func ParseSize added in v1.4.0

func ParseSize(size string) (int64, error)

parse size for ephemeral volumes

Types

type Formatter

type Formatter struct {
	//logrus.TextFormatter
	// Timestamp format
	TimestampFormat string
	// Available standard keys: time, msg, lvl
	// Also can include custom fields but limited to strings.
	// All of fields need to be wrapped inside %% i.e %time% %msg%
	LogFormat string

	CallerPrettyfier func(*runtime.Frame) (function string, file string)
}

Formatter implements logrus.Formatter interface.

func (*Formatter) Format

func (f *Formatter) Format(entry *logrus.Entry) ([]byte, error)

Format building log message.

Jump to

Keyboard shortcuts

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