qm: resize implemented (copy of ct resize)

This commit is contained in:
Denis Knauf 2021-06-23 23:42:29 +02:00
parent 4dbb21f1c1
commit c7c9bf4800
2 changed files with 12 additions and 0 deletions

View file

@ -26,6 +26,13 @@ def cli_qm
STDERR.puts "! #{$?.exitstatus}" unless Proxmox::Qemu.find!( name_or_id).exec *command
}
ct_cli.cmd( :resize, 'Resize a disk', &lambda {|name_or_id, disk, size|
connect
qm = Proxmox::Qemu.find! name_or_id
task = qm.resize disk, size
wait task, text: "Resizing #{qm.sid} #{disk} to #{size}"
})
qm.cmd 'help', '', aliases: ['-h', '--help'], &lambda {|*args| help qm, *args }
}
end

View file

@ -404,6 +404,11 @@ module Proxmox
def exec *args
node.exec 'qm', 'guest', 'exec', vmid, '--', *args
end
def resize disk, size
upid = rest_put "#{@rest_prefix}/resize", disk: disk, size: size
Task.send :__new__, node: @node, host: self, upid: upid
end
end
class LXC < Hosted