Beispiel #1
0
func (cmd *change) Register(ctx context.Context, f *flag.FlagSet) {
	cmd.DatacenterFlag, ctx = flags.NewDatacenterFlag(ctx)
	cmd.DatacenterFlag.Register(ctx, f)

	cmd.DrsConfig = new(types.ClusterDrsConfigInfo)
	cmd.DasConfig = new(types.ClusterDasConfigInfo)
	cmd.VsanConfig = new(types.VsanClusterConfigInfo)
	cmd.VsanConfig.DefaultConfig = new(types.VsanClusterConfigInfoHostDefaultInfo)

	// DRS
	f.Var(flags.NewOptionalBool(&cmd.DrsConfig.Enabled), "drs-enabled", "Enable DRS")

	drsModes := []string{
		string(types.DrsBehaviorManual),
		string(types.DrsBehaviorPartiallyAutomated),
		string(types.DrsBehaviorFullyAutomated),
	}
	f.StringVar((*string)(&cmd.DrsConfig.DefaultVmBehavior), "drs-mode", "",
		"DRS behavior for virtual machines: "+strings.Join(drsModes, ", "))

	// HA
	f.Var(flags.NewOptionalBool(&cmd.DasConfig.Enabled), "ha-enabled", "Enable HA")

	// vSAN
	f.Var(flags.NewOptionalBool(&cmd.VsanConfig.Enabled), "vsan-enabled", "Enable vSAN")
	f.Var(flags.NewOptionalBool(&cmd.VsanConfig.DefaultConfig.AutoClaimStorage), "vsan-autoclaim", "")
}
Beispiel #2
0
func (cmd *mark) Register(ctx context.Context, f *flag.FlagSet) {
	cmd.HostSystemFlag, ctx = flags.NewHostSystemFlag(ctx)
	cmd.HostSystemFlag.Register(ctx, f)

	f.Var(flags.NewOptionalBool(&cmd.ssd), "ssd", "Mark as SSD")
	f.Var(flags.NewOptionalBool(&cmd.local), "local", "Mark as local")
}
Beispiel #3
0
func (cmd *configure) Register(f *flag.FlagSet) {
	f.Var(flags.NewOptionalBool(&cmd.Enabled), "enabled", "")
	f.IntVar(&cmd.StartDelay, "start-delay", 0, "")
	f.StringVar(&cmd.StopAction, "stop-action", "", "")
	f.IntVar(&cmd.StopDelay, "stop-delay", 0, "")

	f.Var(flags.NewOptionalBool(&cmd.WaitForHeartbeat), "wait-for-heartbeat", "")
}
Beispiel #4
0
func (cmd *configure) Register(ctx context.Context, f *flag.FlagSet) {
	cmd.AutostartFlag, ctx = newAutostartFlag(ctx)
	cmd.AutostartFlag.Register(ctx, f)

	f.Var(flags.NewOptionalBool(&cmd.Enabled), "enabled", "")
	f.IntVar(&cmd.StartDelay, "start-delay", 0, "")
	f.StringVar(&cmd.StopAction, "stop-action", "", "")
	f.IntVar(&cmd.StopDelay, "stop-delay", 0, "")
	f.Var(flags.NewOptionalBool(&cmd.WaitForHeartbeat), "wait-for-heartbeat", "")
}
Beispiel #5
0
func (cmd *change) Register(ctx context.Context, f *flag.FlagSet) {
	cmd.ClientFlag, ctx = flags.NewClientFlag(ctx)
	cmd.ClientFlag.Register(ctx, f)
	cmd.HostSystemFlag, ctx = flags.NewHostSystemFlag(ctx)
	cmd.HostSystemFlag.Register(ctx, f)

	cmd.VlanId = -1
	f.Var(flags.NewInt32(&cmd.VlanId), "vlan-id", "VLAN ID")
	f.StringVar(&cmd.Name, "name", "", "Portgroup name")
	f.StringVar(&cmd.VswitchName, "vswitch-name", "", "vSwitch name")

	f.Var(flags.NewOptionalBool(&cmd.AllowPromiscuous), "allow-promiscuous", "Allow promiscuous mode")
	f.Var(flags.NewOptionalBool(&cmd.ForgedTransmits), "forged-transmits", "Allow forged transmits")
	f.Var(flags.NewOptionalBool(&cmd.MacChanges), "mac-changes", "Allow MAC changes")
}
Beispiel #6
0
func (cmd *change) Register(f *flag.FlagSet) {
	cmd.DrsConfig = new(types.ClusterDrsConfigInfo)
	cmd.DasConfig = new(types.ClusterDasConfigInfo)

	// DRS
	f.Var(flags.NewOptionalBool(&cmd.DrsConfig.Enabled), "drs-enabled", "Enable DRS")

	drsModes := []string{
		string(types.DrsBehaviorManual),
		string(types.DrsBehaviorPartiallyAutomated),
		string(types.DrsBehaviorFullyAutomated),
	}
	f.StringVar((*string)(&cmd.DrsConfig.DefaultVmBehavior), "drs-mode", "",
		"DRS behavior for virtual machines: "+strings.Join(drsModes, ", "))

	// HA
	f.Var(flags.NewOptionalBool(&cmd.DasConfig.Enabled), "ha-enabled", "Enable HA")
}
Beispiel #7
0
func (cmd *change) Register(ctx context.Context, f *flag.FlagSet) {
	cmd.VirtualMachineFlag, ctx = flags.NewVirtualMachineFlag(ctx)
	cmd.VirtualMachineFlag.Register(ctx, f)

	f.Int64Var(&cmd.MemoryMB, "m", 0, "Size in MB of memory")
	f.Var(flags.NewInt32(&cmd.NumCPUs), "c", "Number of CPUs")
	f.StringVar(&cmd.GuestId, "g", "", "Guest OS")
	f.StringVar(&cmd.Name, "name", "", "Display name")
	f.Var(&cmd.extraConfig, "e", "ExtraConfig. <key>=<value>")

	f.Var(flags.NewOptionalBool(&cmd.NestedHVEnabled), "nested-hv-enabled", "Enable nested hardware-assisted virtualization")
}
Beispiel #8
0
func (s *ResourceConfigSpecFlag) Register(ctx context.Context, f *flag.FlagSet) {
	opts := []struct {
		name  string
		units string
		types.BaseResourceAllocationInfo
	}{
		{"CPU", "MHz", s.CpuAllocation},
		{"Memory", "MB", s.MemoryAllocation},
	}

	for _, opt := range opts {
		prefix := strings.ToLower(opt.name)[:3]
		ra := opt.GetResourceAllocationInfo()
		shares := (*sharesInfo)(ra.Shares)

		f.Int64Var(&ra.Limit, prefix+".limit", 0, opt.name+" limit in "+opt.units)
		f.Int64Var(&ra.Reservation, prefix+".reservation", 0, opt.name+" reservation in "+opt.units)
		f.Var(flags.NewOptionalBool(&ra.ExpandableReservation), prefix+".expandable", opt.name+" expandable reservation")
		f.Var(shares, prefix+".shares", opt.name+" shares level or number")
	}
}