opt(:max_relocate,"-lCOUNT","--max-relocate=COUNT","How often host can be relocate before givingup?",default:2).
opt(:max_restart,"-rCOUNT","--max-restart=COUNT","How often host can be restarted before givingup?",default:2).
opt(:state,"-sSTATE","--state=STATE","Host should have STATE. If you start/stop be `pct/qm/e start/stop` STATE will be set before action.",default:"started")
end
defcli_ha
cli.sub:ha,"Inspect High-Availability"do|hacli|
hacli.cmd(:create,"Create HA for CT/VM",&lambda{|name_or_id,group:,comment:nil,max_relocate:,max_restart:,state:|
hacli.cmd(:active,"CT/VM should be high-available. Options are only for defaults, if not activated, yet.",&lambda{|name_or_id,group:,comment:nil,max_relocate:,max_restart:,state:|
raiseUsageError,"Container or VirtualMachine not found: #{name_or_id}"unlessth
ha=th.ha
ha=ha.createunlessha.active?
ha.stopped!
}
hacli.cmd:reset,"If state of CT/VM is failed, Proxmox will not start/stop it anyway. You have to reset state (state=disabled), first",&lambda{|name_or_id|