5
0
mirror of git://git.proxmox.com/git/qemu-server.git synced 2025-03-12 20:58:26 +03:00

50 Commits

Author SHA1 Message Date
Dominik Csapak
9e784b1154 add pre- start/stop hookscripts to VMs
this adds a new config option for it, and executes it on four
points in time:

'pre-start'
'post-start'
'pre-stop'
'post-stop'

on pre-start we abort if the script fails
and pre-stop will not be called if the vm crashes or if
the vm gets powered off from inside the guest

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2019-02-01 12:58:37 +01:00
Rhonda D'Vine
b14477e718 Fix #1924: add snapshot parameter
The qm CLI command offer the config and showcmd functions. Both of those
outputs may vary with respect to a given snapshot. This adds a switch
that shows the corresponding snapshot's config and command line.

The code needs a newer libpve-guest-common-perl, thus bumping the
dependency.

Signed-off-by: Rhonda D'Vine <rhonda@proxmox.com>
2019-01-30 14:56:43 +01:00
Dominik Csapak
0f56fff292 better cleanup logging for migration
if we migrate a vm we call cleanup but the logging looks like:

Starting cleanup for 101
trying to acquire lock...
 OK
Configuration file 'nodes/pve-ceph-01/qemu-server/101.conf' does not exist

with this patch, we omit any logging in the case we do not have the config,
since we cannot know what to clean up

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2018-11-28 11:04:46 +01:00
Dominik Csapak
3ea84aeb7c add 'qm cleanup'
this is intended to be used with qmeventd, to do
the necessary cleanups when qemu crashes or is being
shut down from within the guest

this can also be the point where we could introduce
shutdown/stop/reboot hooks

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2018-11-14 15:29:59 +01:00
Dominik Csapak
6ee499fff8 fix #1908: add vmgenid config/device
this adds a VM Generation ID device uses by Windows (Server) to determine
some specific actions that may have happened with the vm
such as rollback, restore, etc.

see:

https://docs.microsoft.com/en-us/windows/desktop/hyperv_v2/virtual-machine-generation-identifier

for details on how it works and when it should change

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2018-09-19 12:23:24 +02:00
Thomas Lamprecht
dc02254ec9 qm rescan: fix typo in dryrun description
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2018-08-21 09:21:41 +02:00
Thomas Lamprecht
bf744e94f3 qm: move 'agent' command into 'guest' comand group
with a backwards compatible alias

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2018-07-17 11:01:55 +02:00
Thomas Lamprecht
34e4c0aa6c qm: rename 'ga' command group to 'guest'
https://pve.proxmox.com/pipermail/pve-devel/2018-July/033010.html

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2018-07-17 11:01:55 +02:00
Dominik Csapak
520884deca add exec(-status) to qm
on the commandline the implementation for exec is a bit different
because there we want (by default) to wait for the result,
as opposed to the api, where it is enough to return the pid and
let the client handle the polling

this behaviour is optional and can be turned off, as well as the
timeout of 30 seconds

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2018-07-11 10:29:45 +02:00
Dominik Csapak
8593cbe41c add 'passwd' to qm
this adds a command 'qm ga passwd' so that we can reuse
'qm ga' for future guest agent calls

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2018-07-11 10:29:45 +02:00
Thomas Lamprecht
9224dceefe qm rescan: add dryrun option
tells an user what would get touched, so he has a chance to fix
unwanted things before changes are actually made.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2018-07-11 09:35:45 +02:00
Thomas Lamprecht
6982113858 qm: PVE::PTY is not used anymore 2018-06-27 13:58:42 +02:00
Dominik Csapak
3dba118c89 use get_standard_mapping for cipassword_map
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2018-06-27 13:39:53 +02:00
Thomas Lamprecht
eb84566b49 sync bwlimit description with the container one 2018-03-21 11:15:35 +01:00
Wolfgang Bumiller
7c536e11c4 restore: implement rate limiting
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2018-03-21 11:15:35 +01:00
Wolfgang Bumiller
29d1f14708 cloud-init: make cipassword interactive on the CLI
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2018-03-13 11:32:52 +01:00
Wolfgang Bumiller
3351aacc70 cloud-init: sshkeys are now files on the CLI
This requires a pve-common patch since we need to not only
load the file but also url-encode it.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2018-03-07 09:11:31 +01:00
Dominik Csapak
b8158701aa move guest agent api call to its own file
so we do not pollute the Qemu.pm too much

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2018-02-20 09:55:15 +01:00
Thomas Lamprecht
e5caa02e05 avoid harmful '<>' pattern, explicitly read from STDIN
Fixes problems in CLIHandler using the code pattern:

while (my $line = <>) {
    ...
}

For why this causes only _now_ problems lets first look how <>
behaves:

"The null filehandle <> is special: [...] Input from <> comes either
from standard input, or from each file listed on the command line.
Here's how it works: the first time <> is evaluated, the @ARGV array
is checked, and if it is empty, $ARGV[0] is set to "-" , which when
opened gives you standard input.  The @ARGV array is then processed
as a list of filenames." - 'perldoc perlop'

Recent changes in the CLIHandler code changed how we modfiied @ARGV
Earlier we assumed that the first argument must be the command and
thus shifted it out of @ARGV, now we can have multiple levels of
(sub)commands. This change also changed how we handle @ARGV, we do
not unshift anything but go through the arguments until we got to
the final command and copy the rest of @ARGV as we know that this
must be the commandos arguments.

For '<>' this means that ARGV was still fully populated and perl
tried to open element as a file, which naturally failed.
Thus the change in pve-common only exposed this 'dangerous' code
pattern.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2018-01-22 14:56:27 +01:00
Wolfgang Bumiller
108899b48f qm showcmd --pretty: indent new lines by 2 spaces
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2018-01-10 15:48:59 +01:00
Thomas Lamprecht
16a01738cb qm showcmd: add simple 'pretty' parameter
Shows each parameter value pair in a new line with a backslash at the
end, so it's still possible to copy, paste and execute it, while
being easier to read and edit by humans. This is opt in.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2018-01-10 15:47:05 +01:00
Wolfgang Bumiller
aa320bcd16 qm terminal: add --escape option
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Reviewed-by: Dominik Csapak <d.csapak@proxmox.com>
2017-12-13 14:52:28 +01:00
Emmanuel Kasper
5d942f5aff importovf: explicitly returns undef
We set the returns value to  { type => 'null' } but we returned an empty
string, which was confusing the cli handler.
2017-09-27 14:54:56 +02:00
Wolfgang Bumiller
0f80f1ab6d qm importovf: --dryrun: use json output format 2017-09-25 13:51:53 +02:00
Wolfgang Bumiller
b533b99534 qm importovf: set return type to null 2017-09-25 13:51:53 +02:00
Wolfgang Bumiller
f6306646d8 whitespace fixup 2017-09-25 13:51:53 +02:00
Emmanuel Kasper
7cd9f6d77e Add new qm command 'importovf', to create VMs from an OVF manifest
Currently the following extracted parameters are used to create a VM:
* VM name
* Memory
* Number of cores
* Disks
2017-09-25 13:31:55 +02:00
Fabian Grünbichler
1d5aaa1db5 qm mtunnel/migrate: add resume VMID command
and reformat the legacy SSH variant for readability.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2017-08-07 09:23:56 +02:00
Fabian Grünbichler
bcb51ae8f9 mtunnel: add and handle OK/ERR replies
because we want commands to return meaningful errors, and
print them on the client/source side.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2017-08-07 09:23:56 +02:00
Fabian Grünbichler
79c9e07933 qm mtunnel: add write helper
reduce code duplication.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2017-08-07 09:23:56 +02:00
Fabian Grünbichler
d851846929 qm mtunnel: add tunnel version
to allow detection of supported features/commands for these
and future mtunnel changes.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2017-08-07 09:23:56 +02:00
Emmanuel Kasper
c7db1e40c4 Fix #1417: make sure the target storage allows disk images before importing
This was fixed in c46366fd494c7dd0cd46bf133146e6f7a98e32a4
for 'qm create', but 'qm importdisk' has the same issue
2017-07-13 06:45:58 +02:00
Emmanuel Kasper
8653feebe6 Add new qm command 'importdisk' to import external disk images
The VM must be already existing, and the syntax is

qm importdisk 421 minix204.img pve4tank

where 421 is an already existing VM
2017-06-01 11:05:35 +02:00
Dietmar Maurer
5e4035c739 add setup_environment hook to CLIHandler classes 2017-01-12 14:10:24 +01:00
Alexandre Derumier
63a0937008 add qm nbdstop
we use it to stop remote nbd server

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
2017-01-05 09:09:46 +01:00
Dietmar Maurer
ee2ff074b1 qm agent: pass command as second required argument
usage: qm agent <vmid> <command>
2016-12-01 07:49:30 +01:00
Dietmar Maurer
788a6a35da qm agent: add output formatter 2016-12-01 07:44:23 +01:00
Wolfgang Link
d1a474273b Add qm agent.
This command makes it possible to run commnads on the Qemu-Guest-Agent if it is installed and running.
2016-11-30 12:30:31 +01:00
Dominik Csapak
265db461c6 add qm listsnapshot call
the api call is already there, just not used in qm.pm
copied mostly from pct.pm

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2016-10-19 11:54:03 +02:00
Dominik Csapak
81fff836fb fix verbose qm status output
we did not check if some values were hash refs in
the verbose output.

this patch adds a recursive hash print sub and uses it

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2016-07-26 14:47:55 +02:00
Dietmar Maurer
f625f7f62f use pve-doc-generator to generate man pages 2016-04-08 07:36:29 +02:00
Thomas Lamprecht
04096e7bdd fix call to lock_config and config_file
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2016-03-09 18:08:26 +01:00
Fabian Grünbichler
ffda963f46 Refactor basic config-related methods
Drop load_config, write_config, lock_config[_xx],
check_lock, check_protection, is_template and config_file
in favour of implementions in PVE::AbstractConfig.

Implement guest_type, __config_max_unused_disks,
config_file_lock and cfs_config_path from
PVE::AbstractConfig in PVE::QemuConfig.
2016-03-08 11:41:59 +01:00
Wolfgang Bumiller
12612b09ae Close #880: ability to show paused state via the CLI
qm list and qm status both show suspended VMs as 'running'
while the GUI's status summary shows them as 'paused'.

This patch makes 'qm status' always request the full status
and adds an optional '-full' parameter for 'qm list' to
use a full status query to include the 'paused' state. (This
is optional as it causes qmp requests to all running VMs.)
2016-03-01 11:59:44 +01:00
Fabian Grünbichler
8317c759bf Drop skiplock from write_config
Since write_config was always called with skiplock=1 except
once, it makes sense to drop this parameter like in
PVE::LXC::write_config . If needed in the future, the
caller can use check_lock before write_config anyway.
2016-02-12 12:16:57 +01:00
Fabian Grünbichler
63be43a947 Refactor update_config_nolock -> write_config
The method update_config wrapped update_config_nolock
using lock_config, but to prevent update races the whole
"read config", "do something", "write config" flow was
always protected by lock_config anyway, and update_config
was never called.

Thus, we can safely drop update_config and rename
update_config_nolock to write_config like in PVE::LXC .
2016-02-12 12:14:52 +01:00
Dietmar Maurer
cc7b93ec0c convert qmrestore into a PVE::CLI class
and install bash completion helpers.
2015-10-05 13:10:24 +02:00
Dietmar Maurer
ad9a140f88 fix install path 2015-09-07 11:33:44 +02:00
Dietmar Maurer
335af808a4 improve bash completion 2015-09-07 08:13:07 +02:00
Dietmar Maurer
f3e76e36bc covert qm into a PVE::CLI class, enable bash completions 2015-09-06 15:44:53 +02:00