Skip to content

Commit

Permalink
lxc: Add storage and network flags
Browse files Browse the repository at this point in the history
Signed-off-by: Mark Bolton <[email protected]>
  • Loading branch information
boltmark authored and tomponline committed Feb 13, 2025
1 parent a946cb4 commit fd195f8
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions lxc/project.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,11 @@ func (c *cmdProject) command() *cobra.Command {

// Create.
type cmdProjectCreate struct {
global *cmdGlobal
project *cmdProject
flagConfig []string
global *cmdGlobal
project *cmdProject
flagConfig []string
flagStorage string
flagNetwork string
}

func (c *cmdProjectCreate) command() *cobra.Command {
Expand All @@ -100,6 +102,8 @@ lxc project create p1 < config.yaml
Create a project with configuration from config.yaml`))

cmd.Flags().StringArrayVarP(&c.flagConfig, "config", "c", nil, i18n.G("Config key/value to apply to the new project")+"``")
cmd.Flags().StringVarP(&c.flagStorage, "storage", "s", "", i18n.G("Add a storage pool to be used as the root device in the default profile")+"``")
cmd.Flags().StringVarP(&c.flagNetwork, "network", "n", "", i18n.G("Add a NIC device to the default profile connected to the specified network")+"``")

cmd.RunE = c.run

Expand Down Expand Up @@ -152,6 +156,8 @@ func (c *cmdProjectCreate) run(cmd *cobra.Command, args []string) error {
project := api.ProjectsPost{}
project.Name = resource.name
project.ProjectPut = stdinData
project.StoragePool = c.flagStorage
project.Network = c.flagNetwork

if project.Config == nil {
project.Config = map[string]string{}
Expand Down

0 comments on commit fd195f8

Please sign in to comment.