MCPcopy
hub / github.com/lxc/incus / Command

Method Command

cmd/incus/storage_volume.go:2590–2617  ·  view source on GitHub ↗

Command returns a cobra.Command for use with (*cobra.Command).AddCommand.

()

Source from the content-addressed store, hash-verified

2588
2589// Command returns a cobra.Command for use with (*cobra.Command).AddCommand.
2590func (c *cmdStorageVolumeNBD) Command() *cobra.Command {
2591 cmd := &cobra.Command{}
2592 cmd.Use = cli.U("nbd", cmdStorageVolumeNBDUsage...)
2593 cmd.Short = i18n.G("NBD access to a block storage volume")
2594 cmd.Long = cli.FormatSection(color.DescriptionPrefix, i18n.G(
2595 `NBD access to a block storage volume`,
2596 ))
2597
2598 cli.AddStringFlag(cmd.Flags(), &c.flagAddress, "address", "", "", i18n.G("Specific address to listen on"))
2599 cli.AddBoolFlag(cmd.Flags(), &c.flagWritable, "writable", i18n.G("Get write access to the disk"))
2600
2601 cmd.RunE = c.Run
2602
2603 // completion for pool, volume, host path
2604 cmd.ValidArgsFunction = func(_ *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
2605 if len(args) == 0 {
2606 return c.global.cmpStoragePools(toComplete)
2607 }
2608
2609 if len(args) == 1 {
2610 return c.global.cmpStoragePoolVolumes(args[0])
2611 }
2612
2613 return nil, cobra.ShellCompDirectiveNoFileComp
2614 }
2615
2616 return cmd
2617}
2618
2619// Run runs the actual command logic.
2620func (c *cmdStorageVolumeNBD) Run(cmd *cobra.Command, args []string) error {

Callers 15

commandMethod · 0.95
rsyncFunction · 0.80
sendSetupFunction · 0.80
RecvFunction · 0.80
connectOfflineNBDMethod · 0.80
receiveFromZfsSenderMethod · 0.80
CreateVolumeFromCopyMethod · 0.80
RefreshVolumeMethod · 0.80
ListVolumesMethod · 0.80
sendDatasetMethod · 0.80
sendSubvolumeMethod · 0.80

Calls 3

GFunction · 0.92
cmpStoragePoolsMethod · 0.80
cmpStoragePoolVolumesMethod · 0.80

Tested by

no test coverage detected