5
0
mirror of git://git.proxmox.com/git/qemu-server.git synced 2025-01-25 06:03:52 +03:00

482 Commits

Author SHA1 Message Date
Thomas Lamprecht
c05c90a10d api: vm clone: remove cloned FW conf in error cleanup path
We clone the source VM firewall config before forking the "realcmd"
worker, but did not mind cleaning it up again if the clone failed
somewhere in the worker.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-01-15 08:06:16 +01:00
Thomas Lamprecht
a85ff91ba0 api/qemu: remove some empty newlines and code cleanup
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-01-15 08:02:06 +01:00
Oguz Bektas
eb5e482ded vmconfig_apply_pending: add error handling
wrap around code which can possibly fail in evals to handle them
gracefully, and log errors.

note: this results in a change of behavior in the API. since errors
are handled gracefully instead of "die"ing, when there is a pending
change which cannot be applied for some reason, it will get logged in
the tasklog but the vm will continue booting regardless. the
non-applied change will stay in the pending section of the
configuration.

Signed-off-by: Oguz Bektas <o.bektas@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-01-14 11:50:34 +01:00
Thomas Lamprecht
0c97024d35 api/restore: do not trigger autostart task from locked context
Do the same as for the "create" case, only trigger the "start after
create/restore" task after the locked "realcmd" was done. Else, the
start can never succeed, it also acquires a lock, but restore only
release it once outside of realcmd.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-12-16 15:56:49 +01:00
Thomas Lamprecht
ae200950d4 grammar fix: s/does not exists/does not exist/g
bump versioned build-dependency, as qemu-server has tests checking
for errors, and we fixed an grammar error in pve-storage, so we need
the newer version to ensure our test go through

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-12-13 12:20:56 +01:00
Dominik Csapak
5661a68106 move vmstate check to check_vm_modify_config_perm
so that it gets checked before the special case of removing the vmstate

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2019-12-11 09:02:55 +01:00
Dominik Csapak
75c24bba0a suspend to disk: check more permissions
only VM.PowerMgmt is not enough, since we allocate space on a storage,
so we need VM.Config.Disk on the vm and Datastore.AllocateSpace on the storage

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2019-12-11 09:02:55 +01:00
Stefan Reiter
c3ddb94dc0 fix wrong punctuation in error msg
...leading to ugly line info being printed.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
2019-12-10 11:10:26 +01:00
Stefan Reiter
71c58bb7ed remove $vmid param from print_drive
It isn't used in the sub, but suggest it is needed. No users outside
qemu-server found.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
2019-12-09 11:44:13 +01:00
Thomas Lamprecht
546644e23d api: allow to clear vmstate actively
Sometimes, a user wants to remove the 'suspended' state without
resuming the vm from that state. Since the vm is locked with
'suspended', this was not possible without help from root@pam

This patch allows to delete the vmstate and the suspended lock and
related config entries with it. The user still has to have the right
priviliges and the vm cannot be 'protected' for this to work

Inspired-by: Dominik Csapak <d.csapak@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-11-30 18:22:38 +01:00
Dominik Csapak
6afb679477 implement removal of vmstate via api
we did not actually delete the state if we deleted the 'vmstate' config,
leaving stray vmstates on the disks

actually implement the removal, requiring 'VM.Config.Disk' and
'VM.PowerMgmt' privs

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2019-11-30 17:28:23 +01:00
Thomas Lamprecht
de64f10114 api: use get_vm_arch instead of depreacted basic_machine_info
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-11-25 10:51:44 +01:00
Fabian Grünbichler
a85c6be13e api: catch 'pending' as snapshot name early
instead of only at write_config time.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2019-11-25 10:02:48 +01:00
Thomas Lamprecht
d58b93a8bf vm start use new pve-qemu-machine standard option
'pve-qm-machine' is auto-registered, but for re-use for a new
runningmachine we added the newer pve-qemu-machine standard option.
Use that one to avoid confusion.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-11-25 08:54:14 +01:00
Mira Limbeck
8f2c9019f5 fix #2473: use of unitialized value
With the noerr flag set in parse_volume_id we have to check if
$volname is defined before comparing it to 'cloudinit'.

Signed-off-by: Mira Limbeck <m.limbeck@proxmox.com>
2019-11-21 12:53:40 +01:00
Dominik Csapak
b8e7068a11 add 'tags' option
this is useful as meta information for e.g., provisioning or config
management systems

adding the info also to the 'status' api call to make it easier to show
it in the gui

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2019-11-20 20:24:49 +01:00
Stefan Reiter
0a13e08ec2 refactor: create QemuServer::Monitor for high-level QMP access
QMP and monitor helpers are moved from QemuServer.pm.

By using only vm_running_locally instead of check_running, a cyclic
dependency to QemuConfig is avoided. This also means that the $nocheck
parameter serves no more purpose, and has thus been removed along with
vm_mon_cmd_nocheck.

Care has been taken to avoid errors resulting from this, and
occasionally a manual check for a VM's existance inserted on the
callsite.

Methods have been renamed to avoid redundant naming:
* vm_qmp_command -> qmp_cmd
* vm_mon_cmd -> mon_cmd
* vm_human_monitor_command -> hmp_cmd

mon_cmd is exported since it has many users. This patch also changes all
non-package users of vm_qmp_command to use the mon_cmd helper. Includes
mocking for tests.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
2019-11-20 16:29:23 +01:00
Thomas Lamprecht
7fe8b44c54 clone: pre-create cloud-init disk for destination
While we may not want to copy the cloudinit disk/drive, we still need
to create+allocate the volume, else the next start complains about a
missing CI drive..

fixes commit 7d6c99f0a0026ce07fa0eb858db7b6b7756ae021.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-11-19 10:29:58 +01:00
Aaron Lauterer
255e9c546c api/migration: fix autocomplete for targetstorage
Show storages configured for the target node and not for the current one
because they can be different.

Duplicated the `complete_storage` sub and extended it to extract the
targetnode from the parameters to pass it into the storage_check_enabled
function.

Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
2019-11-18 15:42:18 +01:00
Fabian Grünbichler
95896f80c2 use PVE::RRD for RRD data
refactored from PVE::Cluster. same code, same semantics, different file.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2019-11-18 12:10:25 +01:00
Fabian Grünbichler
f42ea29b18 use PVE::SSHInfo
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2019-11-18 12:10:25 +01:00
Fabian Grünbichler
48cf040f75 use PVE::DataCenterConfig
to make sure that the corresponding cfs_read_file works() works.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2019-11-18 12:10:25 +01:00
Fabian Ebner
1805fac3a7 Use crm-command stop to allow shutdown with timeout and hard stop for HA
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2019-11-14 14:33:02 +01:00
Dominik Csapak
ba728fb535 fix #2457: ga: set-user-password: increase maxLength of password
SHA-512 crypted passwords are longer than 64 byte, and it also does
not make sense to limit passwords to such a short length.  Increase
to 1024, that should be enough for a while, but still limits maximal
password payload to avoid DOS or the like.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2019-11-11 16:28:44 +01:00
Thomas Lamprecht
b924c4355e api/create: remove some empty lines and sort
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-11-08 17:05:53 +01:00
Thomas Lamprecht
b04ea58453 destroy_vm: allow to pass new config and lock instead
This brings qemu more in line with containers, and it's nicer to
allow passing the replacement config if we want to keep it, instead
of setting a "memory: 128" config.

Use that to lock it on removal before final deletion, and on legacy
tar archive restore, in between old VM destruction and new
restoration.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-11-08 17:03:30 +01:00
Fabian Grünbichler
425441e6fa move 'use UUID' statement to correct file
and add the libuuid-perl package to build-depends as well.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2019-11-08 11:22:51 +01:00
Dominik Csapak
6aa43f9238 fix reverting for non-existing configs
reverting a nonexisting option did not work with the latest changes
in pve-guest-common, because we do not delete the pending option
in 'add_to_pending_delete' anymore

this had the effect that we had following in the config:
[pending]
option: pendingvalue
delete: option

which would do the deletion code and the pending add code
(e.g. delete the pending cloud init drive and creating it again)

to avoid that situation, we need to remove the option from the pending hash
in the 'delete loop'

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2019-10-23 11:47:52 +02:00
Mira Limbeck
21e1ee7b32 fix #2344: ignore cloudinit in replication check
When adding a cloudinit disk it does not contain media=cdrom until it is
actually created. This means the check in check_replication fails to
detect cloudinit and it is recognized as normal disk. Then parse_volname
fails because it does not match the vm-$vmid-XYZ format. To fix this we
now check explicitly if the volname matches cloudinit and if so, return
early.

Additionally 2 small cleanups replacing cloudinit regexes with the
same check for volname matches cloudinit.

Signed-off-by: Mira Limbeck <m.limbeck@proxmox.com>
2019-10-18 21:39:05 +02:00
Christian Ebner
d9123ef5b9 fix #1291: add option purge for vm_destroy api call
When destroying a VM, we intentionally did not remove all related
configs such as backup or replication jobs.
The intention of this flag is to allow the removal of references to
the VM being removed from such configs on destroy.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-10-18 21:22:51 +02:00
Thomas Lamprecht
69f2907c79 fixup: renamed conf_table_with_pending to config_with_pending_array
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-10-18 21:00:27 +02:00
Oguz Bektas
59ef70033c api: use guesthelper method for vm_pending path
we can use the shared conf_table_with_pending guesthelper to produce the
config table with the extra delete and pending columns.

Signed-off-by: Oguz Bektas <o.bektas@proxmox.com>
2019-10-18 18:45:27 +02:00
Oguz Bektas
98bc3aeb92 use new config helpers from guest-common for pending changes
most of the pending changes related code has been moved into
AbstractConfig, so we have to call them as class methods from QemuConfig instead.

Signed-off-by: Oguz Bektas <o.bektas@proxmox.com>
2019-10-18 18:45:27 +02:00
Oguz Bektas
d3179e1c36 api: use shared methods in config GET
in config GET call, we can now use the new shared methods from
guest-common, namely load_current_config and load_snapshot_config.

the correct method is called depending on the parameters 'current' or
'snapshot'

Signed-off-by: Oguz Bektas <o.bektas@proxmox.com>
2019-10-18 18:45:27 +02:00
Thomas Lamprecht
5172770df7 followup: use new base config provided destroy_config method
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-10-18 11:20:52 +02:00
Dominic Jäger
3e8e214d73 Fix #2412: Missing VMs in pools
Between calling vm_destroy and removing the ID from user.cfg (remove_vm_access)
creating a new VM with this ID was possible. VMs could go missing from pools as
a consequence.

Adding a lock solves this for clones from the same node. Additionally,
unlinking must happen at the very end of the deletion process to avoid that
other nodes use the ID in the meanwhile.

Co-developed-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
Signed-off-by: Dominic Jäger <d.jaeger@proxmox.com>
2019-10-17 19:23:49 +02:00
Mira Limbeck
7d6c99f0a0 fix #2217: don't copy cloudinit disk on clone
This removes the cloudinit disk from the list of drives to clone. As the
cloudinit disk is recreated on every VM start, it's not necessary to
clone it.

Signed-off-by: Mira Limbeck <m.limbeck@proxmox.com>
2019-09-26 18:13:26 +02:00
Thomas Lamprecht
64e7017e44 buildsys: use $(MAKE) instead of make
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-09-24 18:06:16 +02:00
Thomas Lamprecht
ed94b2adaa followup: reorder error so that $volid is last (potential long)
and add "current" as keyword, further remove the parenthesis for the
post-if, to adapt to Proxmox general perl code style

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-09-23 18:26:27 +02:00
Tim Marx
f8b829aaba add check to resize disk if current size could not be determined
This check ensures that disks aren't unintentionally shrunken, if the
size is zero due to an underlying problem.
2019-09-23 18:25:01 +02:00
Thomas Lamprecht
fda7291362 followup: add newline in warn to avoid extra perl-internal info
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-09-23 13:15:30 +02:00
Fabian Ebner
1373938627 Improve handling and description of migrate with --online
Thanks to Stefan and Thomas for the suggestions.

Changes from v1:
* update parameter description
* warn instead of die

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2019-09-23 13:12:08 +02:00
Thomas Lamprecht
f70a6ea97d api: config deletion: avoid regex on undefined values
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-09-23 12:53:04 +02:00
Dominik Csapak
4c1f3929ea api: deletion: check also pending values for serial/usb
otherwise a user with only VM.Config.HWType cannot
delete a 'pending' usbX: spice or serial: socket option

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2019-09-23 11:24:57 +02:00
Dominik Csapak
165411f0c2 api: add reboot api call
this creates a reboot request file (inspired by pve-container)
and relies on the 'qm cleanup' call by the qmeventd to detect
and restart the vm afterwards

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2019-09-11 14:13:35 +02:00
Dominik Csapak
58f9db6ada api: add missing index child links
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2019-09-10 14:55:28 +02:00
Christian Ebner
de0119f57f Newline cleanup
Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2019-09-04 16:28:31 +02:00
Dominik Csapak
ccab68c22c fix remote viewer live migration
for some reason not setting port results in a port of '65535' which
triggers an execption in http-server anyevent, so we set the port to 0

also, we have to read the ticket from stdin even for 'unix' type secure
migration

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2019-08-20 11:49:24 +02:00
Aaron Lauterer
b2dd61a045 Add audio device to HW permissions
Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
2019-07-18 08:24:39 +02:00
Thomas Lamprecht
32075a2cb8 check_local_storage_availability: only count each unavailable storage once
and some general cleanup

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-06-28 17:39:16 +02:00