commoncmd

package
v3.0.0-rc43 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2026 License: Apache-2.0 Imports: 67 Imported by: 0

Documentation

Overview

Package commoncmd provides utilities and shared functionality to facilitate operations related to managing remotes objects, nodes, and logs for omcmd and oxcmd.

Index

Constants

View Source
const ArgAnnotationKey = "args"

ArgAnnotationKey is the key used for the args annotation on cobra commands

View Source
const DefaultWait = time.Hour

DefaultWait is how long one request is held when no duration is asked for. It is the longest the daemon holds one, and a wait with no duration asks again for as long as it takes, so the default is "until it ends".

View Source
const HeartbeatNameHelp = `` /* 293-byte string literal not displayed */

HeartbeatNameHelp is the NAME paragraph of the actions addressing a heartbeat as a whole, which all take the same argument.

View Source
const HeartbeatStreamNameHelp = `` /* 447-byte string literal not displayed */

HeartbeatStreamNameHelp is the NAME paragraph of the actions addressing one direction of a heartbeat, which is a component of its own.

Variables

View Source
var (
	ErrClientRequest = errors.New("client request")

	ErrClientStatusCode = errors.New("client request unexpected status code")

	ErrEventKindUnexpected = errors.New("unexpected event kind")

	ErrFetchFile = errors.New("fetch file")

	ErrFlagInvalid = errors.New("invalid command flag")

	ErrInstallFile = errors.New("install file")

	ErrPrint = errors.New("print")
)
View Source
var (
	GroupIDObjectKinds    = "object kinds"
	GroupIDOrchestrated   = "orchestrated"
	GroupIDQuery          = "query"
	GroupIDSubsystems     = "subsystems"
	GroupIDResourceGroups = "resource groups"
	GroupIDReplication    = "replication"
)
View Source
var AuditSubsystems = []string{
	daemonenv.ListenerNameFamily,
	daemonenv.ListenerNameInet,
	daemonenv.ListenerNameUX,
	"ccfg",
	"collector",
	"cstat",
	"daemonauth",
	"daemondata",
	"discover",
	"dns",
	"drbdmon",
	"hb",
	"hb.ctrl",
	"hb.main",
	"hb.peer_dropper",
	"hb:",
	"hook",
	"icfg",
	"icfg:",
	"imon",
	"imon:",
	"istat",
	"mntmon",
	"netmon",
	"nmon",
	"omon",
	"omon:",
	"pubsub",
	"runner",
	"scheduler",
}

AuditSubsystems are the names a daemon audit selects its log feed with, as the subsystems register them.

The ones ending with a colon take a suffix: the object path for icfg, imon and omon, the heartbeat id for hb. A name is matched as a glob pattern, so "imon:*" audits every object monitor and "hb.*" every heartbeat component but the streams themselves.

View Source
var (
	ErrCmdClusterEnroll = errors.New("command cluster enroll")
)
View Source
var (
	ErrCmdClusterEvict = errors.New("command cluster evict")
)
View Source
var (
	ErrCmdDaemonAuth = errors.New("command daemon auth")
)
View Source
var ErrStillRunning = errors.New("still running when the wait expired")

ErrStillRunning says a wait expired on work that has not ended. It is not a failure of the work, nor of the request, which is why a wait with no duration asks again rather than reporting it.

View Source
var ListenerNameHelp = `NAME is:

  ` + daemonenv.ListenerNameInet + `  the listener serving the tcp port

` + daemonenv.ListenerNameUX + `, the listener serving the unix socket, has no start, stop or restart
of its own: it lives as long as the daemon does, and the request asking
for it travels through it. Restart the daemon to restart it.`

ListenerNameHelp is the NAME paragraph of the listener lifecycle actions, naming the listeners they may be addressed to. There are only two listeners, and they are the same on every node, so they are named here rather than looked up.

The unix socket listener is named too, saying why it is not a value: a reader who knows it exists, from an audit or from a status, would take its absence for an oversight.

Functions

func APIKeywordItemsToRaw

func APIKeywordItemsToRaw(items api.KeywordItems) rawconfig.T

func AddFlagsGlobal

func AddFlagsGlobal(flags *pflag.FlagSet, p *OptsGlobal)

AddFlagsGlobal adds the global flags to the flag set. This is the common implementation used by both om and ox.

func AddFlagsGlobalWithColorOutput

func AddFlagsGlobalWithColorOutput(flags *pflag.FlagSet, color, output *string)

AddFlagsGlobalWithColorOutput adds color and output flags

func AddFlagsGlobalWithSelector

func AddFlagsGlobalWithSelector(flags *pflag.FlagSet, objectSelector *string, ignoreNotFound *bool)

AddFlagsGlobalWithSelector adds object selector and ignore not found flags

func AddFlagsNodeGlobal

func AddFlagsNodeGlobal(flagSet *pflag.FlagSet, p *OptsNodeGlobal)

func AnySingleNode

func AnySingleNode(selector string, c *client.T) (string, error)

func CheckPRKeyUniqueness

func CheckPRKeyUniqueness() error

CheckPRKeyUniqueness reports the nodes of the cluster that announce the same scsi3 persistent reservation key.

The key identifies a node to the storage, and two nodes holding the same one can each preempt the reservations of the other, which is what a scsireserv resource relies on to keep a peer away from a device it was not given. A duplicate is nearly always a node.conf copied to a peer without redacting the prkey.

The explanation goes to stderr and the error makes the exit code non zero, so that the caller's stdout still holds the value it asked for. A key that could not be read from the daemon is not a duplicate: the caller is told the check did not run, and is not failed for it.

func CmdOrchestrated

func CmdOrchestrated(cmd *cobra.Command)

CmdOrchestrated marks a command as asking the daemon for an orchestration.

It sorts the command into the orchestrated section of the help, and refuses arguments. An orchestration is asked of the objects the selector names and of nothing else, so an argument is a mistake, and cobra would otherwise accept it and drop it: "om <sel> start foo" would start <sel> and say nothing about foo.

A command declaring what its arguments are keeps them, so that the few orchestrations taking one, like resize, say so themselves.

func CmdWithArg

func CmdWithArg(cmd *cobra.Command, arg string)

CmdWithArg appends argument documentation to the command's args annotation. It handles line feeds, padding and indentation to format the text properly. The argument description will be displayed in the "Arguments:" section of the help output.

func CollectorCredential

func CollectorCredential(filename string) (user, password string, err error)

CollectorCredential returns the collector user and password held by the file at filename, or by the OSVC_COLLECTOR_CREDENTIAL environment variable when filename is empty, and two empty strings when neither is set: a node then registers with the id it already holds.

It is parsed where the command is typed rather than where the registration happens, so that a malformed credential is reported once, before any node is asked to register.

func ColorizeINI

func ColorizeINI(b []byte) []byte

func CommandNames

func CommandNames(cmd *cobra.Command) []string

CommandNames returns the name of cmd and its aliases, deduplicated: a command naming itself in its own alias list is one name, not two.

func ConfigWaitClient

func ConfigWaitClient(wait bool, duration time.Duration) (*client.T, context.Context, context.CancelFunc, error)

ConfigWaitClient returns the client a configuration update is made with, and the context bounding it.

A wait holds the answer for as long as the wait, which is longer than a client allows an answer by default, so the client allows it and the context bounds it, with a margin for the answer to travel.

func DataFromConfigFile

func DataFromConfigFile(fpath string) ([]byte, error)

func DataFromConfigHttp

func DataFromConfigHttp(u uri.T) ([]byte, error)

func DataFromStdin

func DataFromStdin() ([]byte, error)

func DataFromTemplate

func DataFromTemplate(template string) ([]byte, error)

func DeprecatedFlagDownTo

func DeprecatedFlagDownTo(flags *pflag.FlagSet, p *string)

func DeprecatedFlagSubsets

func DeprecatedFlagSubsets(flags *pflag.FlagSet, p *string)

func DeprecatedFlagTags

func DeprecatedFlagTags(flags *pflag.FlagSet, p *string)

func DeprecatedFlagUpTo

func DeprecatedFlagUpTo(flags *pflag.FlagSet, p *string)

func Doc

func Doc(w io.Writer, items api.KeywordDefinitionItems, kind naming.Kind, driver, kw string, depth int) error

Doc renders the documentation of the keywords of an object configuration.

The keywords carry what the rbac policy says about them, because an object configuration is what a user without the root grant sends to the api, and the policy decides which of its keywords the api accepts.

func FlagCPUProfile

func FlagCPUProfile(flags *pflag.FlagSet, p *string)

func FlagCollectorApp

func FlagCollectorApp(flags *pflag.FlagSet, p *string)

func FlagCollectorCredential

func FlagCollectorCredential(flags *pflag.FlagSet, p *string)

FlagCollectorCredential registers the only way a collector credential reaches a command, besides the OSVC_COLLECTOR_CREDENTIAL environment variable. It names a file rather than carrying the value, for the reason FlagCredential does.

func FlagCollectorPassword

func FlagCollectorPassword(flags *pflag.FlagSet, p *string)

FlagCollectorPassword registers the deprecated --password option, hidden for the reason FlagCollectorUser is.

func FlagCollectorUser

func FlagCollectorUser(flags *pflag.FlagSet, p *string)

FlagCollectorUser registers the deprecated --user option, kept for the commands that were typed against the previous release. It is hidden: --credential is the documented way in, because it names a file instead of carrying the password on a command line.

func FlagColor

func FlagColor(flags *pflag.FlagSet, p *string)

func FlagComplianceAttach

func FlagComplianceAttach(flags *pflag.FlagSet, p *bool)

func FlagComplianceForce

func FlagComplianceForce(flags *pflag.FlagSet, p *bool)

func FlagConfigWait

func FlagConfigWait(flags *pflag.FlagSet, p *bool)

FlagConfigWait is the --wait of a configuration update.

func FlagConfirm

func FlagConfirm(flags *pflag.FlagSet, p *bool)

func FlagCreateConfig

func FlagCreateConfig(flags *pflag.FlagSet, p *string)

func FlagCreateEnv

func FlagCreateEnv(flags *pflag.FlagSet, p *[]string)

func FlagCreateForce

func FlagCreateForce(flags *pflag.FlagSet, p *bool)

func FlagCreateNamespace

func FlagCreateNamespace(flags *pflag.FlagSet, p *string)

func FlagCreateRestore

func FlagCreateRestore(flags *pflag.FlagSet, p *bool)

func FlagCredential

func FlagCredential(flags *pflag.FlagSet, p *string)

FlagCredential registers the only way a credential reaches a command, besides the OSVC_CREDENTIAL environment variable. It names a file rather than carrying the value: a command line is readable by any user through the process table, and stays in the shell history.

func FlagCron

func FlagCron(flags *pflag.FlagSet, p *bool)

func FlagDaemonExecFilters

func FlagDaemonExecFilters(flags *pflag.FlagSet, options *CmdDaemonExecList)

FlagDaemonExecFilters declares the options that narrow a listing of execs, on the listing and on every preset of it, so the same question is asked the same way wherever it is asked.

func FlagDaemonHeartbeatFilter

func FlagDaemonHeartbeatFilter(flags *pflag.FlagSet, p *string)

func FlagDaemonLogLevel

func FlagDaemonLogLevel(flags *pflag.FlagSet, p *string)

func FlagDepth

func FlagDepth(flags *pflag.FlagSet, p *int)

func FlagDevRoles

func FlagDevRoles(flags *pflag.FlagSet, p *string)

func FlagDisableRollback

func FlagDisableRollback(flags *pflag.FlagSet, p *bool)

func FlagDiscard

func FlagDiscard(flags *pflag.FlagSet, p *bool)

func FlagDriver

func FlagDriver(flags *pflag.FlagSet, p *string)

func FlagDryRun

func FlagDryRun(flags *pflag.FlagSet, p *bool)

func FlagDuration

func FlagDuration(flags *pflag.FlagSet, p *time.Duration)

func FlagEnv

func FlagEnv(flags *pflag.FlagSet, p *[]string)

func FlagEval

func FlagEval(flags *pflag.FlagSet, p *bool)

func FlagEventFilters

func FlagEventFilters(flags *pflag.FlagSet, p *[]string)

func FlagEventLimit

func FlagEventLimit(flags *pflag.FlagSet, p *uint64)

func FlagEventOutput

func FlagEventOutput(flags *pflag.FlagSet, p *string)

func FlagEventReplay

func FlagEventReplay(flags *pflag.FlagSet, p *bool)

func FlagEventTemplate

func FlagEventTemplate(flags *pflag.FlagSet, p *string)

func FlagEventWait

func FlagEventWait(flags *pflag.FlagSet, p *bool)

func FlagForce

func FlagForce(flags *pflag.FlagSet, p *bool)

func FlagFrom

func FlagFrom(flags *pflag.FlagSet, p *string)

func FlagIgnoreNoCollectorConfigured

func FlagIgnoreNoCollectorConfigured(flags *pflag.FlagSet, p *bool)

func FlagIgnoreNotFound

func FlagIgnoreNotFound(flags *pflag.FlagSet, p *bool)

func FlagImpersonate

func FlagImpersonate(flags *pflag.FlagSet, p *string)

func FlagInterruptSyncs

func FlagInterruptSyncs(flags *pflag.FlagSet, p *bool)

func FlagKey

func FlagKey(flags *pflag.FlagSet, p *string)

func FlagKeyName

func FlagKeyName(flags *pflag.FlagSet, p *string)

func FlagKeyNames

func FlagKeyNames(flags *pflag.FlagSet, p *[]string)

func FlagKeyTo

func FlagKeyTo(flags *pflag.FlagSet, p *string)

func FlagKeyValue

func FlagKeyValue(flags *pflag.FlagSet, p *string)

func FlagKeys

func FlagKeys(flags *pflag.FlagSet, p *[]string)

func FlagKeyword

func FlagKeyword(flags *pflag.FlagSet, p *string)

func FlagKeywordOps

func FlagKeywordOps(flags *pflag.FlagSet, p *[]string)

func FlagKeywordSelection

func FlagKeywordSelection(flags *pflag.FlagSet, p *[]string)

FlagKeywordSelection declares the --kw of the commands reading keywords, which take patterns: see configkeywords.IsPattern.

func FlagKeywords

func FlagKeywords(flags *pflag.FlagSet, p *[]string)

func FlagLeader

func FlagLeader(flags *pflag.FlagSet, p *bool)

func FlagLive

func FlagLive(flags *pflag.FlagSet, p *bool)

func FlagLocal

func FlagLocal(flags *pflag.FlagSet, p *bool)

func FlagMaster

func FlagMaster(flags *pflag.FlagSet, p *bool)

func FlagMatch

func FlagMatch(flags *pflag.FlagSet, p *string)

func FlagModule

func FlagModule(flags *pflag.FlagSet, p *string)

func FlagModuleset

func FlagModuleset(flags *pflag.FlagSet, p *string)

func FlagMoveTo

func FlagMoveTo(flags *pflag.FlagSet, p *string)

func FlagNetworkName

func FlagNetworkName(flags *pflag.FlagSet, p *[]string)

func FlagNetworkStatusExtended

func FlagNetworkStatusExtended(flags *pflag.FlagSet, p *bool)

func FlagNetworkStatusName

func FlagNetworkStatusName(flags *pflag.FlagSet, p *string)

func FlagNoLock

func FlagNoLock(flags *pflag.FlagSet, p *bool)

func FlagNodeSelector

func FlagNodeSelector(flags *pflag.FlagSet, p *string)

func FlagNodeSelectorFilter

func FlagNodeSelectorFilter(flags *pflag.FlagSet, p *string)

func FlagNodeSelectorOrAll

func FlagNodeSelectorOrAll(flags *pflag.FlagSet, p *string)

func FlagNodeSelectorOrLocalnode

func FlagNodeSelectorOrLocalnode(flags *pflag.FlagSet, p *string)

FlagNodeSelectorOrLocalnode declares the node selector of a command whose subject is this node unless another is named.

The default is the name of the node rather than the word "localhost", which the selector has no meaning for: it would look for a node of that name and find none.

func FlagNodeSelectorWithDefault

func FlagNodeSelectorWithDefault(flags *pflag.FlagSet, p *string, def string)

FlagNodeSelectorWithDefault declares the node selector of a command that om and ox default differently: om answers for the node it runs on, ox has no node of its own to prefer.

func FlagObjectSelector

func FlagObjectSelector(flags *pflag.FlagSet, p *string)

func FlagOutput

func FlagOutput(flags *pflag.FlagSet, p *string)

func FlagOutputSections

func FlagOutputSections(flags *pflag.FlagSet, p *string)

func FlagPeerSelectorFilter

func FlagPeerSelectorFilter(flags *pflag.FlagSet, p *string)

func FlagPoolName

func FlagPoolName(flags *pflag.FlagSet, p *string)

func FlagPoolPhysical

func FlagPoolPhysical(flags *pflag.FlagSet, p *bool)

func FlagPoolStatusExtended

func FlagPoolStatusExtended(flags *pflag.FlagSet, p *bool)

func FlagProvision

func FlagProvision(flags *pflag.FlagSet, p *bool)

func FlagRID

func FlagRID(flags *pflag.FlagSet, p *string)

func FlagRIDWithCompletion

func FlagRIDWithCompletion(cmd *cobra.Command, p *string)

FlagRIDWithCompletion adds the --rid flag to the given command and registers bash completion for it using the instance.Status resource map. Only provides completion if the selector is a valid path (not a filtering expression). Gets RIDs from status.json if present in the object's var directory (om only), otherwise falls back to the API.

func FlagRecover

func FlagRecover(flags *pflag.FlagSet, p *bool)

func FlagRedactSecrets

func FlagRedactSecrets(flags *pflag.FlagSet, p *bool)

func FlagRefresh

func FlagRefresh(flags *pflag.FlagSet, p *bool)

func FlagRefreshResInfo

func FlagRefreshResInfo(flags *pflag.FlagSet, p *bool)

func FlagRelay

func FlagRelay(flags *pflag.FlagSet, p *string)

func FlagRoles

func FlagRoles(flags *pflag.FlagSet, p *[]string)

func FlagRuleset

func FlagRuleset(flags *pflag.FlagSet, p *string)

func FlagSCSIHBA

func FlagSCSIHBA(flags *pflag.FlagSet, p *string)

func FlagSCSILUN

func FlagSCSILUN(flags *pflag.FlagSet, p *string)

func FlagSCSITarget

func FlagSCSITarget(flags *pflag.FlagSet, p *string)

func FlagSections

func FlagSections(flags *pflag.FlagSet, p *[]string)

func FlagSlave

func FlagSlave(flags *pflag.FlagSet, p *[]string)

func FlagSlaves

func FlagSlaves(flags *pflag.FlagSet, p *bool)

func FlagSort

func FlagSort(flags *pflag.FlagSet, p *string)

FlagSort declares the option that orders a listing, overriding the order the command comes in by default.

A term names a column, by the header the table shows it under, or the field a tab expression would select. A term prefixed with "-" reverses that term, and a whole expression prefixed with "+" extends the command's default rather than replacing it. A leading "-" has to be written as --sort=-NAME, or the flag parser reads it as the next option.

func FlagStateOnly

func FlagStateOnly(flags *pflag.FlagSet, p *bool)

func FlagSubset

func FlagSubset(flags *pflag.FlagSet, p *string)

func FlagSwitchTo

func FlagSwitchTo(flags *pflag.FlagSet, p *string)

func FlagTag

func FlagTag(flags *pflag.FlagSet, p *string)

func FlagTarget

func FlagTarget(flags *pflag.FlagSet, p *[]string)

func FlagTime

func FlagTime(flags *pflag.FlagSet, p *time.Duration)

func FlagTo

func FlagTo(flags *pflag.FlagSet, p *string)

func FlagToken

func FlagToken(flags *pflag.FlagSet, p *string)

FlagToken registers the only way a join token reaches a command, besides the OSVC_JOIN_TOKEN environment variable. It names a file rather than carrying the value, for the reason FlagCredential does.

func FlagUpdateDelete

func FlagUpdateDelete(flags *pflag.FlagSet, p *[]string)

func FlagUpdateSet

func FlagUpdateSet(flags *pflag.FlagSet, p *[]string)

func FlagUpdateUnset

func FlagUpdateUnset(flags *pflag.FlagSet, p *[]string)

func FlagWait

func FlagWait(flags *pflag.FlagSet, p *bool)

func FlagWatch

func FlagWatch(flags *pflag.FlagSet, p *bool)

func FlagsAsync

func FlagsAsync(flags *pflag.FlagSet, p *OptsAsync)

func FlagsEncap

func FlagsEncap(flags *pflag.FlagSet, p *OptsEncap)

func FlagsLock

func FlagsLock(flags *pflag.FlagSet, p *OptsLock)

func FlagsLogs

func FlagsLogs(flags *pflag.FlagSet, p *OptsLogs)

func FlagsResourceSelector

func FlagsResourceSelector(cmd *cobra.Command, p *OptsResourceSelector)

func FlagsTo

func FlagsTo(flags *pflag.FlagSet, p *OptTo)

func ForProgram

func ForProgram(s string) string

ForProgram renders a help text written for the om command under the name the binary was invoked as, so an ox help does not tell its reader to type om. The commands of the two binaries are built here, from one source, and the root command names itself the same way.

func GroupCommands

func GroupCommands(cmd *cobra.Command, groupID string) []*cobra.Command

GroupCommands returns the commands of cmd the usage template prints under the group.

func HasGroup

func HasGroup(cmd *cobra.Command, groupID string) bool

HasGroup is true when cmd declares the section.

func HeartbeatNames

func HeartbeatNames() []string

HeartbeatNames returns the heartbeats the local cluster configuration defines, named as the actions take them: "1" for the "hb#1" section.

func HeartbeatStreamNames

func HeartbeatStreamNames() []string

HeartbeatStreamNames returns the names a stream action may be addressed to: each heartbeat the local cluster configuration defines, which stands for both of its streams, and each of those streams.

func HiddenFlagDisableRollback

func HiddenFlagDisableRollback(flags *pflag.FlagSet, p *bool)

func HiddenFlagForce

func HiddenFlagForce(flags *pflag.FlagSet, p *bool)

func HiddenFlagLeader

func HiddenFlagLeader(flags *pflag.FlagSet, p *bool)

func HiddenFlagMaster

func HiddenFlagMaster(flags *pflag.FlagSet, p *bool)

func HiddenFlagNoLock

func HiddenFlagNoLock(flags *pflag.FlagSet, p *bool)

func HiddenFlagNodeSelector

func HiddenFlagNodeSelector(flags *pflag.FlagSet, p *string)

func HiddenFlagObjectSelector

func HiddenFlagObjectSelector(flags *pflag.FlagSet, p *string)

func HiddenFlagRID

func HiddenFlagRID(flags *pflag.FlagSet, p *string)

func HiddenFlagRIDWithCompletion

func HiddenFlagRIDWithCompletion(cmd *cobra.Command, p *string)

HiddenFlagRIDWithCompletion adds the hidden --rid flag to the given command and registers bash completion for it using the instance.Status resource map.

func HiddenFlagSlave

func HiddenFlagSlave(flags *pflag.FlagSet, p *[]string)

func HiddenFlagSlaves

func HiddenFlagSlaves(flags *pflag.FlagSet, p *bool)

func HiddenFlagSubset

func HiddenFlagSubset(flags *pflag.FlagSet, p *string)

func HiddenFlagTag

func HiddenFlagTag(flags *pflag.FlagSet, p *string)

func HiddenFlagTo

func HiddenFlagTo(flags *pflag.FlagSet, p *string)

func HiddenFlagsEncap

func HiddenFlagsEncap(flags *pflag.FlagSet, p *OptsEncap)

func HiddenFlagsLock

func HiddenFlagsLock(flags *pflag.FlagSet, p *OptsLock)

func HiddenFlagsResourceSelectorWithCompletion

func HiddenFlagsResourceSelectorWithCompletion(cmd *cobra.Command, p *OptsResourceSelector)

HiddenFlagsResourceSelectorWithCompletion adds hidden resource selector flags to the given command and registers bash completion for the --rid flag

func HiddenFlagsTo

func HiddenFlagsTo(flags *pflag.FlagSet, p *OptTo)

func InstanceStatusUpdatedWaiter

func InstanceStatusUpdatedWaiter(ctx context.Context, paths naming.Paths) (func(), error)

func IsStillRunning

func IsStillRunning(err error) bool

IsStillRunning says an answer is nothing but waits that expired on work still running, which is the one answer worth asking again for. A node that failed to answer at all is not.

func KeywordStoreFromAPI

func KeywordStoreFromAPI(items api.KeywordDefinitionItems) (store keywords.Store)

func MergeSelector

func MergeSelector(selector string, subsysSelector string, kind string, defaultSelector string) string

func NewCmdAll

func NewCmdAll() *cobra.Command

NewCmdAll creates the "all" command

func NewCmdAnyConfigUpdate

func NewCmdAnyConfigUpdate() *cobra.Command

func NewCmdArrayList

func NewCmdArrayList() *cobra.Command

func NewCmdCcfg

func NewCmdCcfg() *cobra.Command

NewCmdCcfg creates the "ccfg" command

func NewCmdCfg

func NewCmdCfg() *cobra.Command

NewCmdCfg creates the "cfg" command

func NewCmdClusterAbort

func NewCmdClusterAbort() *cobra.Command

func NewCmdClusterEnroll

func NewCmdClusterEnroll() *cobra.Command

func NewCmdClusterEvict

func NewCmdClusterEvict() *cobra.Command

func NewCmdClusterFreeze

func NewCmdClusterFreeze() *cobra.Command

func NewCmdClusterLogs

func NewCmdClusterLogs() *cobra.Command

func NewCmdClusterRegister

func NewCmdClusterRegister() *cobra.Command

func NewCmdClusterSSHTrust

func NewCmdClusterSSHTrust() *cobra.Command

func NewCmdClusterStatus

func NewCmdClusterStatus() *cobra.Command

func NewCmdClusterThaw

func NewCmdClusterThaw() *cobra.Command

func NewCmdClusterUnfreeze

func NewCmdClusterUnfreeze() *cobra.Command

func NewCmdDaemon

func NewCmdDaemon() *cobra.Command

func NewCmdDaemonAudit

func NewCmdDaemonAudit() *cobra.Command

func NewCmdDaemonAuth

func NewCmdDaemonAuth() *cobra.Command

func NewCmdDaemonDNS

func NewCmdDaemonDNS() *cobra.Command

func NewCmdDaemonDNSDump

func NewCmdDaemonDNSDump() *cobra.Command

func NewCmdDaemonEvents

func NewCmdDaemonEvents() *cobra.Command

func NewCmdDaemonExec

func NewCmdDaemonExec() *cobra.Command

NewCmdDaemonExec returns the command group of the runs the daemon made, one per object per node, which is the scale the outcome is at.

func NewCmdDaemonExecList

func NewCmdDaemonExecList(defaultNodeSelector string) *cobra.Command

NewCmdDaemonExecList returns the listing of the exec store.

defaultNodeSelector is what --node defaults to: om answers for the node it runs on, ox has no node of its own to prefer.

func NewCmdDaemonExecLogs

func NewCmdDaemonExecLogs() *cobra.Command

NewCmdDaemonExecLogs returns the logs of one exec.

func NewCmdDaemonExecWait

func NewCmdDaemonExecWait(defaultNodeSelector string) *cobra.Command

NewCmdDaemonExecWait returns the command waiting for the end of an exec.

func NewCmdDaemonHeartbeat

func NewCmdDaemonHeartbeat() *cobra.Command

func NewCmdDaemonHeartbeatList

func NewCmdDaemonHeartbeatList(defaultNodeSelectorFilter string) *cobra.Command

func NewCmdDaemonHeartbeatRestart

func NewCmdDaemonHeartbeatRestart() *cobra.Command

func NewCmdDaemonHeartbeatRotate

func NewCmdDaemonHeartbeatRotate() *cobra.Command

func NewCmdDaemonHeartbeatStart

func NewCmdDaemonHeartbeatStart() *cobra.Command

func NewCmdDaemonHeartbeatStatus

func NewCmdDaemonHeartbeatStatus(defaultNodeSelectorFilter string) *cobra.Command

NewCmdDaemonHeartbeatStatus is the name the list command answered to before the listings were named after what they render: a row per stream. It is kept for the readers whose fingers and scripts type it.

func NewCmdDaemonHeartbeatStop

func NewCmdDaemonHeartbeatStop() *cobra.Command

func NewCmdDaemonKill

func NewCmdDaemonKill() *cobra.Command

func NewCmdDaemonListener

func NewCmdDaemonListener() *cobra.Command

func NewCmdDaemonListenerRestart

func NewCmdDaemonListenerRestart() *cobra.Command

func NewCmdDaemonListenerStart

func NewCmdDaemonListenerStart() *cobra.Command

func NewCmdDaemonListenerStop

func NewCmdDaemonListenerStop() *cobra.Command

func NewCmdDaemonLog

func NewCmdDaemonLog() *cobra.Command

func NewCmdDaemonOrchestration

func NewCmdDaemonOrchestration() *cobra.Command

NewCmdDaemonOrchestration returns the command group of the orchestrations the monitor accepted.

func NewCmdDaemonOrchestrationLogs

func NewCmdDaemonOrchestrationLogs() *cobra.Command

NewCmdDaemonOrchestrationLogs returns the logs of one orchestration.

func NewCmdDaemonPs

func NewCmdDaemonPs() *cobra.Command

NewCmdDaemonPs returns the listing of what the daemon is running now.

It is CmdDaemonExecList with the running state preselected and the pid leading the table. What is running and what has run are the same records at different ages, so there is one implementation and this is a preset of it, rather than a second command that can drift from the first.

func NewCmdDaemonRelay

func NewCmdDaemonRelay() *cobra.Command

func NewCmdDaemonRelayList

func NewCmdDaemonRelayList() *cobra.Command

func NewCmdDaemonRelayStatus

func NewCmdDaemonRelayStatus() *cobra.Command

NewCmdDaemonRelayStatus is the name the list command answered to before the listings were named after what they render: a row per relay client. It is kept for the readers whose fingers and scripts type it.

func NewCmdDaemonRestart

func NewCmdDaemonRestart() *cobra.Command

func NewCmdDaemonRun

func NewCmdDaemonRun() *cobra.Command

func NewCmdDaemonRunning

func NewCmdDaemonRunning() *cobra.Command

func NewCmdDaemonSession

func NewCmdDaemonSession() *cobra.Command

NewCmdDaemonSession returns the command group of the commands submitted to the daemon, which it remembers so a client that submitted one can ask how it ended.

func NewCmdDaemonSessionList

func NewCmdDaemonSessionList() *cobra.Command

NewCmdDaemonSessionList returns the listing of sessions.

It defaults to every node, where the exec listing defaults to this one: a session spans the nodes it reached, and folding only the local share of it would report a count that is not the session's.

func NewCmdDaemonSessionLogs

func NewCmdDaemonSessionLogs() *cobra.Command

NewCmdDaemonSessionLogs returns the logs of one session.

func NewCmdDaemonSessionWait

func NewCmdDaemonSessionWait() *cobra.Command

NewCmdDaemonSessionWait returns the command waiting for the end of a session.

func NewCmdDaemonShutdown

func NewCmdDaemonShutdown() *cobra.Command

func NewCmdDaemonStart

func NewCmdDaemonStart() *cobra.Command

func NewCmdDaemonStatus

func NewCmdDaemonStatus() *cobra.Command

func NewCmdDaemonStop

func NewCmdDaemonStop() *cobra.Command

func NewCmdHeartbeatSign

func NewCmdHeartbeatSign() *cobra.Command

func NewCmdHeartbeatWipe

func NewCmdHeartbeatWipe() *cobra.Command

func NewCmdMonitor

func NewCmdMonitor() *cobra.Command

func NewCmdNetwork

func NewCmdNetwork() *cobra.Command

NewCmdNetwork creates the "network" command

func NewCmdNetworkIP

func NewCmdNetworkIP() *cobra.Command

NewCmdNetworkIP creates the "ip" subcommand for network

func NewCmdNode

func NewCmdNode() *cobra.Command

func NewCmdNodeCapabilities

func NewCmdNodeCapabilities() *cobra.Command

NewCmdNodeCapabilities creates the "capabilities" subcommand for node

func NewCmdNodeCollector

func NewCmdNodeCollector() *cobra.Command

NewCmdNodeCollector creates the "collector" subcommand for node

func NewCmdNodeCollectorTag

func NewCmdNodeCollectorTag() *cobra.Command

NewCmdNodeCollectorTag creates the "tag" subcommand for node collector

func NewCmdNodeCompliance

func NewCmdNodeCompliance() *cobra.Command

NewCmdNodeCompliance creates the "compliance" subcommand for node

func NewCmdNodeConfigDoc

func NewCmdNodeConfigDoc() *cobra.Command

func NewCmdNodeMetrics

func NewCmdNodeMetrics() *cobra.Command

func NewCmdNodeRelay

func NewCmdNodeRelay() *cobra.Command

NewCmdNodeRelay creates the "relay" subcommand for node

func NewCmdNodeSCSI

func NewCmdNodeSCSI() *cobra.Command

NewCmdNodeSCSI creates the "scsi" subcommand for node

func NewCmdNodeSSH

func NewCmdNodeSSH() *cobra.Command

NewCmdNodeSSH creates the "ssh" subcommand for node

func NewCmdNscfg

func NewCmdNscfg() *cobra.Command

NewCmdNscfg creates the "nscfg" command

func NewCmdObjectApp

func NewCmdObjectApp(kind string) *cobra.Command

func NewCmdObjectCap

func NewCmdObjectCap(kind string) *cobra.Command

NewCmdObjectCap returns the cap command of a kind.

Its help lists the pg_* keywords of the store, with their example and the first sentence of their text, so it documents every cap the command sets, the ones added later included.

func NewCmdObjectClear

func NewCmdObjectClear(kind string) *cobra.Command

func NewCmdObjectCollector

func NewCmdObjectCollector(kind string) *cobra.Command

func NewCmdObjectCompliance

func NewCmdObjectCompliance(kind string) *cobra.Command

func NewCmdObjectConfig

func NewCmdObjectConfig(kind string) *cobra.Command

func NewCmdObjectConfigDoc

func NewCmdObjectConfigDoc(kind string) *cobra.Command

func NewCmdObjectContainer

func NewCmdObjectContainer(kind string) *cobra.Command

func NewCmdObjectDisk

func NewCmdObjectDisk(kind string) *cobra.Command

func NewCmdObjectFS

func NewCmdObjectFS(kind string) *cobra.Command

func NewCmdObjectGroupInfo

func NewCmdObjectGroupInfo(kind, group string) *cobra.Command

func NewCmdObjectGroupList

func NewCmdObjectGroupList(kind, group string) *cobra.Command

func NewCmdObjectGroupProvision

func NewCmdObjectGroupProvision(kind, group string) *cobra.Command

func NewCmdObjectGroupResize

func NewCmdObjectGroupResize(kind, group string) *cobra.Command

NewCmdObjectGroupResize returns the command that changes the size of a resource and of everything it rests on.

func NewCmdObjectGroupRestart

func NewCmdObjectGroupRestart(kind, group string) *cobra.Command

func NewCmdObjectGroupRun

func NewCmdObjectGroupRun(kind, group string) *cobra.Command

func NewCmdObjectGroupShutdown

func NewCmdObjectGroupShutdown(kind, group string) *cobra.Command

func NewCmdObjectGroupStart

func NewCmdObjectGroupStart(kind, group string) *cobra.Command

func NewCmdObjectGroupStartStandby

func NewCmdObjectGroupStartStandby(kind, group string) *cobra.Command

func NewCmdObjectGroupStop

func NewCmdObjectGroupStop(kind, group string) *cobra.Command

func NewCmdObjectGroupUnprovision

func NewCmdObjectGroupUnprovision(kind, group string) *cobra.Command

func NewCmdObjectIP

func NewCmdObjectIP(kind string) *cobra.Command

func NewCmdObjectInstance

func NewCmdObjectInstance(kind string) *cobra.Command

func NewCmdObjectInstanceClear

func NewCmdObjectInstanceClear(kind, defaultNodeSelector string) *cobra.Command

func NewCmdObjectInstanceDevice

func NewCmdObjectInstanceDevice(kind string) *cobra.Command

func NewCmdObjectInstancePG

func NewCmdObjectInstancePG(kind string) *cobra.Command

func NewCmdObjectKey

func NewCmdObjectKey(kind string) *cobra.Command

func NewCmdObjectKeyAdd

func NewCmdObjectKeyAdd(kind string) *cobra.Command

func NewCmdObjectKeyChange

func NewCmdObjectKeyChange(kind string) *cobra.Command

func NewCmdObjectKeyDecode

func NewCmdObjectKeyDecode(kind string) *cobra.Command

func NewCmdObjectKeyEdit

func NewCmdObjectKeyEdit(kind string) *cobra.Command

func NewCmdObjectKeyInstall

func NewCmdObjectKeyInstall(kind string) *cobra.Command

func NewCmdObjectKeyList

func NewCmdObjectKeyList(kind string) *cobra.Command

func NewCmdObjectKeyRemove

func NewCmdObjectKeyRemove(kind string) *cobra.Command

func NewCmdObjectKeyRename

func NewCmdObjectKeyRename(kind string) *cobra.Command

func NewCmdObjectMonitor

func NewCmdObjectMonitor(selector, kind string) *cobra.Command

func NewCmdObjectPrint

func NewCmdObjectPrint(kind string) *cobra.Command

func NewCmdObjectResource

func NewCmdObjectResource(kind string) *cobra.Command

func NewCmdObjectSSH

func NewCmdObjectSSH(kind string) *cobra.Command

func NewCmdObjectSchedule

func NewCmdObjectSchedule(kind string) *cobra.Command

func NewCmdObjectShare

func NewCmdObjectShare(kind string) *cobra.Command

func NewCmdObjectSync

func NewCmdObjectSync(kind string) *cobra.Command

func NewCmdObjectTask

func NewCmdObjectTask(kind string) *cobra.Command

func NewCmdObjectVolume

func NewCmdObjectVolume(kind string) *cobra.Command

func NewCmdPool

func NewCmdPool() *cobra.Command

NewCmdPool creates the "pool" command

func NewCmdPoolVolume

func NewCmdPoolVolume() *cobra.Command

NewCmdPoolVolume creates the "volume" subcommand for pool

func NewCmdSVC

func NewCmdSVC() *cobra.Command

NewCmdSVC creates the "svc" command

func NewCmdSec

func NewCmdSec() *cobra.Command

NewCmdSec creates the "sec" command

func NewCmdUsr

func NewCmdUsr() *cobra.Command

NewCmdUsr creates the "usr" command

func NewCmdVol

func NewCmdVol() *cobra.Command

NewCmdVol creates the "vol" command

func NewGroupObjectKinds

func NewGroupObjectKinds() *cobra.Group

NewGroupObjectKinds returns the section listing the commands scoped to an object kind, at the root of the command tree.

func NewGroupOrchestrated

func NewGroupOrchestrated() *cobra.Group

func NewGroupQuery

func NewGroupQuery() *cobra.Group

func NewGroupReplication

func NewGroupReplication() *cobra.Group

func NewGroupResources

func NewGroupResources() *cobra.Group

func NewGroupSubsystems

func NewGroupSubsystems() *cobra.Group

func NodeDoc

func NodeDoc(w io.Writer, items api.KeywordDefinitionItems, kind naming.Kind, driver, kw string, depth int) error

NodeDoc renders the documentation of the keywords of the node configuration.

They carry no rbac line: the node configuration is not written through the api by a user holding a grant on a namespace, so the policy that gates the object configurations says nothing about them.

func NodesFromPaths

func NodesFromPaths(c *client.T, selector string) ([]string, error)

func ObjectInstanceDeleteRemoteFunc

func ObjectInstanceDeleteRemoteFunc(ctx context.Context, p naming.Path, nodename string) (interface{}, error)

func PatchObjectConfig

func PatchObjectConfig(ctx context.Context, c *client.T, p naming.Path, params api.PatchObjectConfigParams) (bool, error)

PatchObjectConfig writes the keyword operations of params to the configuration of p, and says whether it changed.

With params.Wait, the daemon holds the answer until the configuration has reached every live node of the object. A wait that expires is an error naming where it has not landed, after a write that was made all the same: writing again would apply a += operation twice.

func PostDaemonRestart

func PostDaemonRestart(ctx context.Context, cli *client.T, nodename string) error

PostDaemonRestart sends an api request to restart the daemon and handles the response status codes.

func PostDaemonStop

func PostDaemonStop(ctx context.Context, cli *client.T, nodename string) error

PostDaemonStop sends an api request to stop the daemon and handles the response status codes.

func RawStringSliceVar

func RawStringSliceVar(flags *pflag.FlagSet, p *[]string, name string, value []string, usage string)

RawStringSliceVar declares a repeatable option whose values are taken whole.

func RawStringSliceVarP

func RawStringSliceVarP(flags *pflag.FlagSet, p *[]string, name, shorthand string, value []string, usage string)

RawStringSliceVarP declares a repeatable option whose values are taken whole. It lives in util/flagvalue, which the command sets that cannot import this package reach too.

func ReadPasswordFromStdinOrPrompt

func ReadPasswordFromStdinOrPrompt(prompt string) ([]byte, error)

func RefreshInstanceStatusFromClusterStatus

func RefreshInstanceStatusFromClusterStatus(ctx context.Context, clusterStatus clusterdump.Data) error

RefreshInstanceStatusFromClusterStatus updates instance statuses for all nodes using cluster status data. It ensures instance status updates before return. Returns an error if client creation, API calls, or processing fails.

func RenderDuration

func RenderDuration(startedAt time.Time, endedAt *time.Time, now time.Time) string

RenderDuration is how long a span lasted, or how long it has lasted so far when it has not ended.

The records carry the two ends and not the length: two numbers that answer the same question can disagree, and these two did. The length is derived here, where it is wanted, and derived the same way for an exec, a session and an orchestration.

A running span is measured against the reader's clock, where its start came from the node that ran it, so a clock skew can make it negative. FmtShortDuration answers "0s" for that rather than a negative age.

func SecretFromFileOrEnv

func SecretFromFileOrEnv(filename, envVar string) (string, error)

SecretFromFileOrEnv returns the secret held by the file at filename, or the value of the envVar environment variable when filename is empty, or an empty string when neither is set.

A secret never reaches a command as a flag value: a command line is readable by any user through the process table, and stays in the shell history. So the flags naming one, --token and --credential, name a file, and the environment is what the daemon uses to hand a secret to a command it forks.

The file wins over the environment, so that an operator naming a file is told about a bad path instead of silently getting an inherited value.

func SectionBody

func SectionBody(cmd *cobra.Command, title string) (string, bool)

SectionBody returns what the usage of cmd prints under the section title, up to the next empty line, and whether the section is there at all.

func Sections

func Sections(b []byte, sections []string) []byte

func SelectorFromStdin

func SelectorFromStdin() string

func SetCustomUsageTemplate

func SetCustomUsageTemplate(cmd *cobra.Command)

SetCustomUsageTemplate sets the custom help template on a command. This template will display an Arguments section if the command has an "args" annotation. It uses [FLAGS] (uppercase) instead of [flags] for consistency with [ID].

func SetKeywordsFromArgs

func SetKeywordsFromArgs(keywords *[]string, args []string)

SetKeywordsFromArgs adds the keywords named as positional arguments to the ones the --kw flag named.

Naming a keyword is what these commands are for, so it is the argument, and --kw is kept for the scripts written before it was.

func SetRIDFromArgs

func SetRIDFromArgs(rid *string, args []string, group, defaultRID string)

func SetSectionsFromArgs

func SetSectionsFromArgs(sections *[]string, args []string)

SetSectionsFromArgs adds the sections named as positional arguments to the ones the --section flag named.

Naming a section is how this command is narrowed, so it is the argument, and --section is kept for the scripts written before it was.

func SetWait

func SetWait(cmd *cobra.Command, wait *time.Duration, unbounded *bool) error

SetWait reads what the caller asked to wait for.

No duration is a wait with no end: the daemon holds one request for an hour at most, so the wait is that hour asked again for as long as it takes, which is what unbounded says. A duration that is not positive is refused, rather than silently making a wait command a listing that reports success on work still running.

func UsageFlagEventFilter

func UsageFlagEventFilter() string

func UsageFlagEventTemplate

func UsageFlagEventTemplate() string

func ValidateArgs

func ValidateArgs(root *cobra.Command, args []string) error

ValidateArgs returns an error when args name a command that does not exist.

cobra walks the command chain and, when the deepest command it reaches has no Run function, prints that command help and returns no error, silently dropping whatever was typed after it. A stale or mistyped command path exits 0 that way, which is how the daemon scheduler and the api exec kept reporting successful runs of commands renamed under their hard-coded argv.

func WaitAllInstanceMonitor

func WaitAllInstanceMonitor(ctx context.Context, c *client.T, p naming.Path, timeout time.Duration, errC chan error) error

func WaitInstanceMonitor

func WaitInstanceMonitor(ctx context.Context, c *client.T, p naming.Path, timeout time.Duration, errC chan error) error

WaitInstanceMonitor launches a go routine that waits for a specific instance monitor update event within a given timeout, or ctx.Done() reached. The result of the wait is sent to the errC channel: nil if the InstanceMonitorUpdated event occurs, or a non-nil error otherwise.

If acquiring the event reader fails, WaitInstanceMonitor returns the error immediately and does not send anything to errC.

func WaitInstanceStatusUpdated

func WaitInstanceStatusUpdated(ctx context.Context, c *client.T, nodename string, p naming.Path, timeout time.Duration, errC chan error) error

WaitInstanceStatusUpdated launches a go routine that waits for a specific instance status update event within a given timeout, or ctx.Done() reached. The result of the wait is sent to the errC channel: nil if the InstanceStatusUpdated event occurs, or a non-nil error otherwise.

If acquiring the event reader fails, WaitInstanceStatusUpdated returns the error immediately and does not send anything to errC.

func WaitObjectKnown

func WaitObjectKnown(ctx context.Context, c *client.T, p naming.Path, timeout time.Duration, errC chan error) error

WaitAllInstanceMonitor launches a go routine that waits for all instance monitor updated events are received for an object within a given timeout, or ctx.Done() reached. The result of the wait is sent to the errC channel: nil if the InstanceMonitorUpdated event occurs, or a non-nil error otherwise.

It also filters the ObjectConfigUpdated events to get the expected Instance monitor updated events from the instance config scope nodes.

If acquiring the event reader fails, WaitInstanceMonitor returns the error immediately and does not send anything to errC. WaitObjectKnown watches for the daemon to know p, and sends nil on errC once it does: listed, which is how a selection names it, and watched by an instance monitor, on any node, which is what an action is asked of.

It is started before the configuration of p is written, so no event is missed between the write and the wait. The daemon learns of an object a moment after its configuration file is written, and a command run in that moment is told the object does not exist.

func WalkCommands

func WalkCommands(cmd *cobra.Command, f func(*cobra.Command))

WalkCommands calls f on cmd and on every command below it.

Types

type CmdClusterAbort

type CmdClusterAbort struct {
	Color  string
	Output string
	Sort   string
	OptsAsync
}

func (*CmdClusterAbort) Run

func (t *CmdClusterAbort) Run() error

type CmdClusterConfigDoc

type CmdClusterConfigDoc struct {
	Color   string
	Output  string
	Keyword string
	Driver  string
	Depth   int
}

func (*CmdClusterConfigDoc) Run

func (t *CmdClusterConfigDoc) Run() error

type CmdClusterEnroll

type CmdClusterEnroll struct {
	// Node is the location of the node to enroll, in the
	// [<scheme>://]<addr>[:<port>] format.
	Node string

	// TokenFile is the path of a file holding an access token with the
	// join role, created on the node to enroll. When empty, the
	// OSVC_JOIN_TOKEN environment variable is used.
	TokenFile string

	// JoinAddr is the location the enrolled node must use to reach the
	// cluster it joins.
	JoinAddr string

	// Timeout is the lifetime of the join token handed to the enrolled
	// node, and the maximum duration to wait for the join to complete.
	Timeout time.Duration

	// Wait blocks until the enrolled node heartbeat is beating.
	Wait bool
}

func (*CmdClusterEnroll) Run

func (t *CmdClusterEnroll) Run() error

type CmdClusterEvict

type CmdClusterEvict struct {
	// Node is the nodename to remove from the cluster nodes.
	Node string

	// CredentialFile is the path of a file holding the
	// <username>:<password> of the user to create on the evicted node.
	CredentialFile string

	// Timeout is the maximum duration of the leave forked on the evicted
	// node, and the maximum duration to wait for it when Wait is set.
	Timeout time.Duration

	// Wait blocks until the cluster has dropped the evicted node.
	Wait bool
}

func (*CmdClusterEvict) Run

func (t *CmdClusterEvict) Run() error

type CmdClusterFreeze

type CmdClusterFreeze struct {
	OptsAsync
	Color  string
	Output string
	Sort   string
}

func (*CmdClusterFreeze) Run

func (t *CmdClusterFreeze) Run() error

type CmdClusterLogs

type CmdClusterLogs struct {
	OptsLogs
	Color  string
	Output string
}

func (*CmdClusterLogs) Run

func (t *CmdClusterLogs) Run() error

type CmdClusterRegister

type CmdClusterRegister struct {
	CredentialFile string
	App            string
}

func (*CmdClusterRegister) Run

func (t *CmdClusterRegister) Run() error

type CmdClusterSSHTrust

type CmdClusterSSHTrust struct {
}

func (*CmdClusterSSHTrust) Run

func (t *CmdClusterSSHTrust) Run() error

type CmdClusterUnfreeze

type CmdClusterUnfreeze struct {
	OptsAsync
	Color  string
	Output string
	Sort   string
}

func (*CmdClusterUnfreeze) Run

func (t *CmdClusterUnfreeze) Run() error

type CmdDaemonAudit

type CmdDaemonAudit struct {
	CmdDaemonSubAction
	Output     string
	Level      string
	Subsystems []string
	Preempt    bool
}

func (*CmdDaemonAudit) Run

func (t *CmdDaemonAudit) Run() error

type CmdDaemonAuth

type CmdDaemonAuth struct {
	Roles           []string
	Subject         string
	Scope           string
	AccessDuration  time.Duration
	Out             string
	Refresh         bool
	RefreshDuration time.Duration
}

func (*CmdDaemonAuth) Run

func (t *CmdDaemonAuth) Run() error

type CmdDaemonDNSDump

type CmdDaemonDNSDump struct {
	Color        string
	Output       string
	Sort         string
	NodeSelector string
}

func (*CmdDaemonDNSDump) Run

func (t *CmdDaemonDNSDump) Run() error

type CmdDaemonEvents

type CmdDaemonEvents struct {
	OptsGlobal
	Filters  []string
	Duration time.Duration
	Limit    uint64
	Template string
	Wait     bool

	// Replay is used to enable replay event from the cached state
	Replay bool

	Quiet bool

	NodeSelector string
	// contains filtered or unexported fields
}

func (*CmdDaemonEvents) DoNodes

func (t *CmdDaemonEvents) DoNodes() error

type CmdDaemonExecList

type CmdDaemonExecList struct {
	NodeSelector    string
	Output          string
	Color           string
	States          []string
	Origins         []string
	SessionID       string
	OrchestrationID string
	ExecID          string
	RID             string
	Selector        string

	// Columns is the table this renders. "om daemon ps" leads with the
	// pid, the listing leads with the outcome.
	Columns string

	// Sort overrides the order the listing comes in.
	Sort string

	// Wait holds each request until the execs it asks about have ended,
	// and is how "om daemon exec|session wait" waits: the daemon answers
	// when the work is over rather than when it is asked, so a caller
	// neither polls nor keeps an event stream open for it.
	Wait time.Duration

	// Unbounded says the caller named no duration and waits for as long
	// as it takes. The daemon holds one request for an hour at most, so
	// that wait is the request asked again until the work ends.
	Unbounded bool
}

CmdDaemonExecList lists the commands the daemon ran and is running.

It is the one listing of the exec store, and "om daemon ps" is it with the running state preselected: what is running and what has run are the same records at different ages, so they are read by one code path and shown in one shape.

func (*CmdDaemonExecList) Gather

func (t *CmdDaemonExecList) Gather() ([]api.ExecItem, error)

Gather asks every selected node and returns what they answered together.

An exec is node-local, so the union over the nodes is the whole of what a command did. A node that has forgotten an id it is asked for by name is not an error when another still holds it, which is why the by-id answers are folded in rather than returned.

func (*CmdDaemonExecList) Run

func (t *CmdDaemonExecList) Run() error

func (*CmdDaemonExecList) RunWait

func (t *CmdDaemonExecList) RunWait() error

RunWait waits for the execs it selects to end, reports them, and says whether any of them failed.

An exec id is what one run of one object on one node is called, and the node that ran it is the only one that knows how it went, so this asks the nodes the selector names and folds what they answer.

type CmdDaemonHeartbeatList

type CmdDaemonHeartbeatList struct {
	Color        string
	Output       string
	Sort         string
	NodeSelector string
	PeerSelector string
	Name         string
}

func (*CmdDaemonHeartbeatList) Run

func (t *CmdDaemonHeartbeatList) Run() error

type CmdDaemonHeartbeatRestart

type CmdDaemonHeartbeatRestart struct {
	CmdDaemonSubAction
	Names []string
}

func (*CmdDaemonHeartbeatRestart) Run

type CmdDaemonHeartbeatRotate

type CmdDaemonHeartbeatRotate struct {
	Wait bool
	Time time.Duration
}

func (*CmdDaemonHeartbeatRotate) Run

type CmdDaemonHeartbeatSign

type CmdDaemonHeartbeatSign struct {
	CmdDaemonSubAction
	Names []string
}

func (*CmdDaemonHeartbeatSign) Run

func (t *CmdDaemonHeartbeatSign) Run() error

type CmdDaemonHeartbeatStart

type CmdDaemonHeartbeatStart struct {
	CmdDaemonSubAction
	Names []string
}

func (*CmdDaemonHeartbeatStart) Run

func (t *CmdDaemonHeartbeatStart) Run() error

type CmdDaemonHeartbeatStop

type CmdDaemonHeartbeatStop struct {
	CmdDaemonSubAction
	Names []string
}

func (*CmdDaemonHeartbeatStop) Run

func (t *CmdDaemonHeartbeatStop) Run() error

type CmdDaemonHeartbeatWipe

type CmdDaemonHeartbeatWipe struct {
	CmdDaemonSubAction
	Names []string
	Force bool
}

func (*CmdDaemonHeartbeatWipe) Run

func (t *CmdDaemonHeartbeatWipe) Run() error

type CmdDaemonIDLogs

type CmdDaemonIDLogs struct {
	CmdNodeLogs

	// Key is the log field the id is matched on.
	Key string

	// ID is the id to report the entries of.
	ID string
}

CmdDaemonIDLogs reports the log entries one id names.

The daemon stamps what it runs with the ids it was run under: the exec that forked it, the session the exec belongs to, and the orchestration the session was a step of. A listing hands one of those ids back, and this is how it is followed to what was logged under it.

It is "om node logs" with the filter already written: the ids are log fields, and matching one is what the filter does.

func (*CmdDaemonIDLogs) Run

func (t *CmdDaemonIDLogs) Run() error

type CmdDaemonKill

type CmdDaemonKill struct {
	NodeSelector    string
	Output          string
	Sort            string
	Color           string
	Signal          string
	DryRun          bool
	ExecID          string
	SessionID       string
	OrchestrationID string
	Origins         []string
	RID             string
	Selector        string
}

CmdDaemonKill signals the processes of the execs a filter selects.

It selects them the way "om daemon exec list" selects them, so what that lists is what this signals, and the answer is the same shape: the execs signaled.

func (*CmdDaemonKill) Run

func (t *CmdDaemonKill) Run() error

type CmdDaemonListenerRestart

type CmdDaemonListenerRestart struct {
	CmdDaemonSubAction
	Name string
}

func (*CmdDaemonListenerRestart) Run

type CmdDaemonListenerStart

type CmdDaemonListenerStart struct {
	CmdDaemonSubAction
	Name string
}

func (*CmdDaemonListenerStart) Run

func (t *CmdDaemonListenerStart) Run() error

type CmdDaemonListenerStop

type CmdDaemonListenerStop struct {
	CmdDaemonSubAction
	Name string
}

func (*CmdDaemonListenerStop) Run

func (t *CmdDaemonListenerStop) Run() error

type CmdDaemonLog

type CmdDaemonLog struct {
	CmdDaemonSubAction
	Level string
}

func (*CmdDaemonLog) Run

func (t *CmdDaemonLog) Run() error

type CmdDaemonRelayList

type CmdDaemonRelayList struct {
	Color  string
	Output string
	Sort   string
}

func (*CmdDaemonRelayList) Run

func (t *CmdDaemonRelayList) Run() error

type CmdDaemonSessionList

type CmdDaemonSessionList struct {
	CmdDaemonExecList
}

CmdDaemonSessionList reports sessions, one row per session.

A session is what was submitted; an exec is one run of one object on one node, and one session is several of them. Folding the execs into the session is the work this command exists to do: a reader asking how their command went should not have to count succeeded rows themselves.

The fold is done here and not in the daemon because a session spans nodes and each daemon holds only the execs it ran. A per-node session is a partial one, which is worse than none.

func (*CmdDaemonSessionList) Run

func (t *CmdDaemonSessionList) Run() error

func (*CmdDaemonSessionList) RunWait

func (t *CmdDaemonSessionList) RunWait() error

RunWait waits for every exec of the session to end, reports the session, and says whether any of its execs failed.

type CmdDaemonSubAction

type CmdDaemonSubAction struct {
	Debug        bool
	NodeSelector string

	// OnResponse, when set, receives the body each node answered
	// with. It is called from the goroutine handling that node, so
	// an implementation shared by several nodes serializes itself.
	OnResponse func(nodename string, b []byte)
}

func (*CmdDaemonSubAction) Run

func (t *CmdDaemonSubAction) Run(fn apiFuncWithNode) error

Run daemon sub-component action

func (*CmdDaemonSubAction) RunForEach

func (t *CmdDaemonSubAction) RunForEach(names []string, fn func(name string) apiFuncWithNode) error

RunForEach runs the action once per name, so a command taking several names attempts them all rather than stopping on the first that fails, and reports every failure.

type CmdNodeConfigDoc

type CmdNodeConfigDoc struct {
	Color   string
	Output  string
	Sort    string
	Keyword string
	Driver  string
	Depth   int
}

func (*CmdNodeConfigDoc) Run

func (t *CmdNodeConfigDoc) Run() error

type CmdNodeDequeue

type CmdNodeDequeue struct {
	OptsNodeGlobal
}

CmdNodeDequeue duplicates the omcmd and oxcmd CmdNodeDequeue configuration for nodes based on the specified NodeSelector.

func (*CmdNodeDequeue) Remote

func (t *CmdNodeDequeue) Remote() error

Remote performs a remote action dequeue operation on nodes specified by the NodeSelector and returns any encountered errors.

type CmdNodeLogs

type CmdNodeLogs struct {
	OptsGlobal
	OptsLogs
	NodeSelector string
}

CmdNodeLogs duplicates the omcmd and oxcmd CmdNodeLogs configuration for fetching logs from nodes based on the specified NodeSelector.

func (*CmdNodeLogs) Remote

func (t *CmdNodeLogs) Remote() error

Remote fetches logs remotely from the nodes specified by the NodeSelector, using concurrent streaming for each node. Returns an error if the client setup fails, no nodes are selected, or if there are issues during the process.

type CmdNodeMetrics

type CmdNodeMetrics struct {
	NodeSelector string
}

func (*CmdNodeMetrics) Run

func (t *CmdNodeMetrics) Run() error

type CmdObjectCap

type CmdObjectCap struct {
	OptsGlobal
	OptsAsync
	Set []string
}

CmdObjectCap sets the process group caps of objects and applies them to their running instances.

func (*CmdObjectCap) Run

func (t *CmdObjectCap) Run(kind string) error

Run writes the caps and queues the orchestration applying them.

type CmdObjectConfigDoc

type CmdObjectConfigDoc struct {
	OptsGlobal
	Color   string
	Output  string
	Keyword string
	Driver  string
	Depth   int
}

func (*CmdObjectConfigDoc) Run

func (t *CmdObjectConfigDoc) Run(kind string) error

type CmdObjectConfigMigrate

type CmdObjectConfigMigrate struct {
	OptsGlobal
	OptsLock
	DryRun bool
}

func (*CmdObjectConfigMigrate) Run

func (t *CmdObjectConfigMigrate) Run(kind string) error

Run writes the configurations of the selected objects in the shape om reads them in.

The changes land through the configuration update path, so a migration is weighed like any other write: the same validation, the same policy, the same claim on a pool.

type CmdObjectInstanceClear

type CmdObjectInstanceClear struct {
	ObjectSelector string
	NodeSelector   *string
}

func (*CmdObjectInstanceClear) Run

func (t *CmdObjectInstanceClear) Run(kind string) error

type CmdObjectLogs

type CmdObjectLogs struct {
	OptsGlobal
	OptsLogs
	NodeSelector string
}

CmdObjectLogs duplicates the omcmd and oxcmd CmdObjectLogs configuration for fetching logs from nodes based on the specified NodeSelector.

func (*CmdObjectLogs) Remote

func (t *CmdObjectLogs) Remote(selStr string) error

Remote executes the object log retrieval operation for selected nodes and paths in an asynchronous manner. It leverages the provided selector string to identify target objects and nodes for log streaming.

type CmdObjectMonitor

type CmdObjectMonitor struct {
	Color          string
	ObjectSelector string
	Output         string
	Sections       string
	Watch          bool
}

func (*CmdObjectMonitor) Run

func (t *CmdObjectMonitor) Run(selector, kind string) error

type CmdPoolList

type CmdPoolList struct {
	OptsGlobal
	Name         string
	NodeSelector string
	Physical     bool
}

func (*CmdPoolList) Run

func (t *CmdPoolList) Run() error

type ExecView

type ExecView struct {
	Node            string     `json:"node"`
	State           string     `json:"state"`
	ExecID          string     `json:"exec_id"`
	SessionID       string     `json:"session_id"`
	OrchestrationID string     `json:"orchestration_id,omitempty"`
	Path            string     `json:"path,omitempty"`
	Origin          string     `json:"origin"`
	RID             string     `json:"rid,omitempty"`
	Pid             *int       `json:"pid,omitempty"`
	StartedAt       time.Time  `json:"started_at"`
	EndedAt         *time.Time `json:"ended_at,omitempty"`
	// Duration is rendered, not carried: the two ends are the data. So
	// --sort=duration orders the text of it, where --sort=started_at and
	// --sort=ended_at order the moments they name.
	Duration string `json:"duration,omitempty"`
	ExitCode *int   `json:"exit_code,omitempty"`
	Command  string `json:"command,omitempty"`
	Error    string `json:"error,omitempty"`
}

ExecView is what the table shows: the api reports a duration in nanoseconds and an instant to the nanosecond, which a machine wants and a reader does not.

func ToExecViews

func ToExecViews(items []api.ExecItem) []ExecView

type OptTo

type OptTo struct {
	To     string
	UpTo   string // Deprecated
	DownTo string // Deprecated
}

OptTo sets a barrier when iterating over a resource lister

type OptsAsync

type OptsAsync struct {
	Watch bool
	Wait  bool
	Time  time.Duration
}

OptsAsync contains options accepted by all actions having an orchestration

type OptsEncap

type OptsEncap struct {
	// A list of encap instance, identified by hostname of the container
	Slaves []string

	// The host instance
	Master bool

	// All encap instances
	AllSlaves bool
}

OptsEncap contains options to select where a instance action runs with a encap enabled service

type OptsGlobal

type OptsGlobal struct {
	Color          string
	Output         string
	Sort           string
	ObjectSelector string
	IgnoreNotFound bool
}

type OptsLock

type OptsLock struct {
	Disable bool
	Timeout time.Duration

	// TimeoutSet says --waitlock was given, and Timeout is not its
	// default: an action that would wait longer by default keeps to
	// it.
	TimeoutSet bool
}

OptsLock contains options accepted by all actions using an action lock

type OptsLogs

type OptsLogs struct {
	Follow bool
	Lines  int
	Filter []string
	Grep   *string
}

OptsLogs contains options used by all log commands: node logs, cluster logs, object logs

type OptsNodeGlobal

type OptsNodeGlobal struct {
	Color          string
	Output         string
	Sort           string
	NodeSelector   string
	IgnoreNotFound bool
}

type OptsResourceSelector

type OptsResourceSelector struct {
	RID    string
	Subset string
	Tag    string
}

OptsResourceSelector contains options needed to initialize a resourceselector.Options struct

type PoolLine

type PoolLine struct {
	api.Pool
	BinSize string `json:"bin_size"`
	BinUsed string `json:"bin_used"`
	BinFree string `json:"bin_free"`
}

PoolLine is a pool as a listing shows it: the pool the api sent, and the sizes in the units a reader reads.

The sizes shown are what the pool can hand out to volumes, which is what a volume is asked for in and what a claim rations, and not what the storage behind it holds: a pool whose nodes each hold a copy of every volume hands out what one of them can take. The storage is what the physical listing shows.

The embedded value is inlined, by the json encoder and by the jsonpath the tab expressions are written in alike, so a column names a pool field directly and the columns added here sit next to them.

func NewPoolLine

func NewPoolLine(item api.Pool, physical bool) PoolLine

NewPoolLine returns the pool as a listing shows it, in the sizes it hands out or, when physical is set, in the storage behind them.

type PoolVolumeLine

type PoolVolumeLine struct {
	api.PoolVolume
	Charges string `json:"charges_text"`
}

PoolVolumeLine is a pool volume as a listing shows it: the volume the api sent, and what it takes of other pools in the form a reader reads.

func NewPoolVolumeLine

func NewPoolVolumeLine(item api.PoolVolume) PoolVolumeLine

NewPoolVolumeLine returns the volume as a listing shows it.

type SessionView

type SessionView struct {
	SessionID       string     `json:"session_id"`
	State           string     `json:"state"`
	OrchestrationID string     `json:"orchestration_id,omitempty"`
	Execs           int        `json:"execs"`
	Running         int        `json:"running"`
	Failed          int        `json:"failed"`
	Nodes           int        `json:"nodes"`
	Objects         int        `json:"objects"`
	Origin          string     `json:"origin"`
	StartedAt       time.Time  `json:"started_at"`
	EndedAt         *time.Time `json:"ended_at,omitempty"`
	Duration        string     `json:"duration,omitempty"`
	Command         string     `json:"command,omitempty"`
}

SessionView is one session, folded from its execs.

func ToSessionViews

func ToSessionViews(items []api.ExecItem) []SessionView

ToSessionViews folds execs into the sessions they belong to, newest first.

Directories

Path Synopsis
Package helptest holds the checks the om and ox command trees must both pass.
Package helptest holds the checks the om and ox command trees must both pass.

Jump to

Keyboard shortcuts

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