Config shows IP/netmask. Previously netwmask was missing. Duplicated file qm.rb removed.
This commit is contained in:
parent
a1a8822024
commit
f816ac3bc2
|
@ -2,6 +2,8 @@ require 'pmap'
|
||||||
|
|
||||||
class PVE::Cli
|
class PVE::Cli
|
||||||
|
|
||||||
|
using IPAddress::ToSWithNetmaskForNetworks
|
||||||
|
|
||||||
def cli_base
|
def cli_base
|
||||||
cli.cmd :list, "List CT/VM-IDs", aliases: ['ls'], &lambda {|target=nil|
|
cli.cmd :list, "List CT/VM-IDs", aliases: ['ls'], &lambda {|target=nil|
|
||||||
connect
|
connect
|
||||||
|
|
|
@ -1,3 +1,17 @@
|
||||||
|
module IPAddress::ToSWithNetmaskForNetworks
|
||||||
|
refine IPAddress::IPv6 do
|
||||||
|
def to_s
|
||||||
|
128 == prefix ? super() : to_string
|
||||||
|
end
|
||||||
|
end
|
||||||
|
refine IPAddress::IPv4 do
|
||||||
|
def to_s
|
||||||
|
32 == prefix ? super() : to_string
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
class Measured
|
class Measured
|
||||||
class <<self
|
class <<self
|
||||||
def bytes1 v
|
def bytes1 v
|
||||||
|
|
|
@ -1,32 +0,0 @@
|
||||||
class PVE::Cli
|
|
||||||
def cli_qm
|
|
||||||
cli.sub :qm, "Virtual Machines", aliases: %w[v vm qemu], &lambda {|qm|
|
|
||||||
qm.cmd :list, "List VM-IDs", aliases: ['ls'], &lambda {|node=nil|
|
|
||||||
connect
|
|
||||||
nodes = Proxmox::Node.all
|
|
||||||
nodes = nodes.select {|n| node == n.name } if node
|
|
||||||
nodes.flat_map do |n|
|
|
||||||
n.qemu.map {|c| c.vmid.to_i }
|
|
||||||
end.sort.each {|c| puts c }
|
|
||||||
}
|
|
||||||
|
|
||||||
qm.cmd :status, "List VMs with status", aliases: [nil], &lambda {|node=nil|
|
|
||||||
connect
|
|
||||||
to = TablizedOutput.new %w[Status HA ID Name Host Uptime CPU Mem/MiB Disk/MiB]
|
|
||||||
nodes = Proxmox::Node.all
|
|
||||||
nodes = nodes.select {|n| node == n.name } if node
|
|
||||||
nodes.each do |n|
|
|
||||||
n.qemu.each &to.method( :virt)
|
|
||||||
end
|
|
||||||
to.print order: [3]
|
|
||||||
}
|
|
||||||
|
|
||||||
qm.cmd :exec, "Executes Command in VM via qemu-guest-agent", min: 4, &lambda {|name_or_id, *command|
|
|
||||||
connect
|
|
||||||
STDERR.puts "! #{$?.exitstatus}" unless Proxmox::Qemu.find!( name_or_id).exec *command
|
|
||||||
}
|
|
||||||
|
|
||||||
qm.cmd 'help', '', aliases: ['-h', '--help'], &lambda {|*args| help qm, *args }
|
|
||||||
}
|
|
||||||
end
|
|
||||||
end
|
|
Loading…
Reference in a new issue