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

1430 Commits

Author SHA1 Message Date
Oguz Bektas
df503832ff add md-clear cpu flag
Signed-off-by: Oguz Bektas <o.bektas@proxmox.com>
2019-06-07 17:55:24 +02:00
Mira Limbeck
1e1763e9c8 add qm command for cloudinit config dump
Adds the command 'qm cloudinit dump <vmid> <type>' where type is either
'user', 'network' or 'meta' as specified in the API.

Signed-off-by: Mira Limbeck <m.limbeck@proxmox.com>
2019-06-06 14:34:11 +02:00
Mira Limbeck
7370974930 add new API for dumping cloudinit config
Adds the path '{vmid}/cloudinit/dump' and requires the parameter 'type'
that's either 'user', 'network' or 'meta'. Returns the generated config as
string.

Signed-off-by: Mira Limbeck <m.limbeck@proxmox.com>
2019-06-06 14:34:11 +02:00
Mira Limbeck
e73ca4d0ce add function to dump cloudinit config
This adds a function to dump the generated cloudinit config. Only one
can be dumped at a time, either 'user', 'network' or 'meta'.

The logic to get user, network and metadata is copied from the other
path that also creates the ISO image to keep it simple and not
complicate the other code path further.

The hash generation for the metadata config is unified between nocloud
and configdrive2 formats. We need it a 3rd time with the new dump
functions so it makes sense to combine it and the metadata config
generation in a single function. The <format>_gen_metadata functions are
each used twice now.

Signed-off-by: Mira Limbeck <m.limbeck@proxmox.com>
2019-06-06 14:34:11 +02:00
Thomas Lamprecht
dc62a7fafc drop vnc x509 param, deprecated in 2.5 removed in 4.0
while we have 3.0.1 for now, 4.x will come sooner or later so do this
now already..

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-06-06 09:52:44 +02:00
Thomas Lamprecht
736c92f6d1 api/qemu: start: add helper for root-only param extraction
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-06-06 09:43:49 +02:00
Thomas Lamprecht
a4262553de api/qemu: extra line cleanup
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-06-06 09:41:52 +02:00
Rhonda D'Vine
3e494a3ca7 Fix #1999: cli: listsnapshot: handle multiple roots and mark orphaned as root
This commit addresses the following things:

* There can be multiple independent snapshot tree roots, display them
  all
* If a snapshot defines a parent that doesn't exist, it is now
  considered a snapshot root

There is a potential issue (which was also before and also affects the
GUI): circular snapshot trees.  That plays into the second mentioned
issue above.  If you manage to have a snapshot that defines a
non-existing root in the config, and then create a snapshot with that
exact name as a child of that snapshot, it would create a circular
dependency.  This would have to get addressed in the GUI too.

Signed-off-by: Rhonda D'Vine <rhonda@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-06-05 19:22:30 +02:00
Thomas Lamprecht
90041ba890 drop references to un-maintained sheepdog plugin
we remove it from pve-storage as it's abandoned

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-06-04 17:43:11 +02:00
Thomas Lamprecht
8aa2ed7c85 refactor do_snapshots_with_qemu a bit cleaner
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-06-04 17:41:23 +02:00
Tim Marx
c2ed338eff whitespace cleanup
Signed-off-by: Tim Marx <t.marx@proxmox.com>
2019-05-27 13:59:08 +02:00
Fabian Grünbichler
3e24733bdf vm_resume: correctly honor $nocheck
for both vm_mon_cmd calls. under certain circumstances, the following
sequence of events can otherwise fail when live-migrating under load:

S...source node
T...target node

0: migration is complete, handover from S to T starts
1: S: logically move VM config file from S to T via rename()
2: S: rename returns, config file is (visibly) moved on S
3: S: trigger resume on T via mtunnel
4a: T: call vm_resume while config file move is not yet visible on T
4b: T: call vm_resume while config file move is already visible on T

4a instead of 4b means vm_mon_cmd will die in check_running unless
vm_mon_cmd_nocheck is used.

under heavy pmxcfs load and a slow cluster/corosync network, there can
be a few seconds of delay between 1 and 2, with a subsequent race ending in 4a
instead of 4b.

this issue was reported to occur on bulk migrations.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2019-05-25 11:28:26 +02:00
Thomas Lamprecht
bf4a933e52 fixup: delete cloudinit disk before restoring
cloudinit is just completely broken...
Until we rewrite this to a sane designe (i.e., never backup, mirror,
... any CI disk anywhere - the state is in the config and gets
created on start and deleted on stop anyway) do this..

Co-developed-by: Mira Limbek <m.limbek@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-05-17 12:09:56 +02:00
Thomas Lamprecht
2b2923aefd QemuServer: code cleanup
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-05-17 10:53:50 +02:00
Thomas Lamprecht
87056e1821 follouwp: set is_cloudinit in drive to avoid always rechecking
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-05-17 10:53:30 +02:00
Mira Limbeck
c4ab3c5584 map cloudinit disk to new vmid on restore
Resolves the issue of restoring a VM that has a cloudinit drive
configured to a new VMID. The VMID of the disk name gets now remapped
correctly and in the process the cloudinit disk is created with the same size
as in PVE/API2/Qemu.pm create_disks and in PVE/QemuServer/Cloudinit
commit_cloudinit_disk as the same constant is used.

This is done by matching any line starting with either 'ide', 'sata' or
'scsi' and then check if it is a cloudinit drive. As cloudinit drives
are attached as cdrom, only those 3 are possible. For the cloudinit
check we use 'parse_drive' followed by 'drive_is_cloudinit' so no custom
regex is necessary.

'--targetstorage' is also taken into account on restore now for
cloudinit disks. If a target storage is specified the format is either
kept if possible, or changed to the default of that storage.

This should fix #1807 completely. The restore error was already resolved
with commit 7e8ab2a, but the vmid of the disk might not have matched the new
one.

Signed-off-by: Mira Limbeck <m.limbeck@proxmox.com>
2019-05-16 16:29:02 +02:00
Mira Limbeck
7d761a016d introduce one global CLOUDINIT_DISK_SIZE constant
The variable is used instead of the literal value so we have one single
place to change the actual value of every use.

Signed-off-by: Mira Limbeck <m.limbeck@proxmox.com>
2019-05-16 16:29:02 +02:00
Thomas Lamprecht
a357092190 fixup: shorter/conciser comment
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-05-16 16:29:02 +02:00
Mira Limbeck
e1afab6e28 fix clone_disk with formats other than raw/qcow2
with commit 64d1a6a it's now possible to specify a format other than raw
or qcow2 when creating VMs. This can lead to an error when cloning the
VMs and a cloudinit disk with a different format is attached (e.g.
vmdk).

We use QEMU_FORMAT_RE in drive_is_cloudinit and according to the
QEMU_FORMAT_RE we support 7 different formats.

With this change we add any format other than 'raw' as '.<format>' to the
name and no longer die on any other format. Cloudinit disks with invalid
format are not cloned as the drive is recognized as cdrom, not cloudinit.

Signed-off-by: Mira Limbeck <m.limbeck@proxmox.com>
2019-05-16 16:27:07 +02:00
Thomas Lamprecht
5cda6c69e3 followup: fixup comment
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-05-15 16:33:46 +02:00
Mira Limbeck
9680b09d64 fix existing cloudinit volume not available for file_size_info
file_size_info can't find the file if it is not available, e.g.,
RBD storage with KRBD or LVM where the volume was not yet activated,
returns then 0, which we interpret as the disk not existing, thus
call vdisk_alloc which errors as the disk, in fact, really already exists.

With this patch we call activate_volume before trying
file_size_info, so if the volume exists we get it available and else
we can really create it.
If the disk does not exist and is created with vdisk_alloc we still
require an additional call to activate_volume for the new disk.

Signed-off-by: Mira Limbeck <m.limbeck@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-05-15 16:31:52 +02:00
Thomas Lamprecht
96f00fd866 fix #503: print correct offline time for stop mode backups
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-05-15 16:28:15 +02:00
Thomas Lamprecht
9e05909534 fixup: correct initial prefix
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-05-13 06:05:51 +00:00
Thomas Lamprecht
e85263a20e minor followup cleanups
remove now out of date commen about 'our', left over from previous
revision

Pass firs $prefix directly to function and some other small stuff

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-05-13 05:50:37 +00:00
Rhonda D'Vine
5f1dc9af73 fix #1999: create a tree view for qm listsnapshot
The look of the tree is based on the GUI variant, so that we have a
consistent output when run multiple times, too.

Signed-off-by: Rhonda D'Vine <rhonda@proxmox.com>
2019-05-13 05:38:36 +00:00
Tim Marx
ca6abacf6b migrate: log which local resource causes error
Signed-off-by: Tim Marx <t.marx@proxmox.com>
2019-05-07 10:22:12 +00:00
Tim Marx
370b05e719 whitespace cleanup
Signed-off-by: Tim Marx <t.marx@proxmox.com>
2019-05-07 10:22:12 +00:00
Thomas Lamprecht
92fcaab73a cloudinit: use detected format in volname parsing
keep the ?, as format is raw if no file ending is there, which we
want to handle too.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-04-30 13:24:56 +00:00
Thomas Lamprecht
84821d1515 followup: do not query size of image we just created
we know the size, and even if a storage plugin pads this up (it
mustn't alloc something smaller, but something bigger can be OK) we
know that our 4MB is OK, and can only be used anyway to make this
compatible between storage plugins.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-04-30 13:09:23 +00:00
Thomas Lamprecht
6aaf593cfd followup: make ISO exists check a bit stricter
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-04-30 13:07:55 +00:00
Mira Limbeck
b56d56cf3a fix #2173: use qemu-img to check cloudinit disk existence
use file_size_info to check for existence of cloudinit disk instead of
'-e'. It uses `qemu-img info` to get some file info, which can handle
rbd, and various other paths for volumes not exposed as normal file
or not mapped, yet.

this addresses a problem with rbd where the path returned available
is not checkable with '-e'.

Any size > 0 is interpreted as the image existing.

Signed-off-by: Mira Limbeck <m.limbeck@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-04-30 12:53:28 +00:00
Christian Ebner
5294c110bb fix: #1075: Restore VM template to VM and try to convert to template.
The restore of a backup from a VM template will first restore the VM and then
convert the restored VM back into a template.
This automatically performes the steps of the current behaviour, where the user
has to manually convert the restored VM back to a template.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2019-04-24 17:35:32 +00:00
Thomas Lamprecht
4fdc1d3dfc create ci disk: long line cleanup
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-04-24 13:33:32 +00:00
Thomas Lamprecht
c152600b93 followup: keep raw as default for non-path based stores
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-04-24 13:27:16 +00:00
Wolfgang Link
64d1a6aedf fix #1829: Cloudinit ignore format parameter
When a Cloudinit image is created, we allow choosing
the format as parameter.
So, the parameter should also be taken into account.

The default for Cloudinit will stay qcow2 on directory storages.
2019-04-16 08:14:22 +00:00
Thomas Lamprecht
9741526189 followup: expand check_vm_modify_config_perm comment
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-04-12 16:19:45 +02:00
Dominik Csapak
165be267eb allow non root users to add spice usb port
using the same logic like serialX: socket
users need VM.Config.HWType for usbX: spice
but only root can add/remove real devices

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2019-04-12 16:13:52 +02:00
Dominik Csapak
e30f75c571 move check for serialX: socket
since we do not want the user to change a device which has a real
devices already set, we have to check it later when we have the config

so we do not have to give the params to vm_check_modify_config_perm anymore

also improve the regex to \d+

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2019-04-12 16:13:46 +02:00
Dominik Csapak
e545304343 fix #1811: allow non root user to edit serialX: socket entries
use VM.Config.HWType for 'socket' and root@pam for real serial devices

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2019-04-11 14:06:48 +02:00
Thomas Lamprecht
f0dbdb6896 code cleanup
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-04-05 17:37:18 +02:00
Alwin Antreich
ee43cd487c fix creating clone if target storage is same as source storage
the clone API calls (target) 'storage' parameter is optional as we
simply use the source storage in this case, but we did not handle
this case when we added the bandwidth_limit abillity, address that.

This patch only pushes the storage parameter into the storage_list array
if it is defined.

Signed-off-by: Alwin Antreich <a.antreich@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-04-05 14:46:53 +02:00
Thomas Lamprecht
f6409f6169 followup: remove unused variable and add spave between value and unit
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-04-02 14:33:10 +02:00
Thomas Lamprecht
41756a3b8a followup: reword bwlimit default wording
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-04-02 11:01:35 +02:00
Stoiko Ivanov
0aab5a16b3 bwlimit: add parameter to API2 calls
for migrate_vm, clone_vm and move_vm_disk and extract it. The 'migrate_vm' call
passes it to PVE::QemuMigrate->migrate for handling.

Additionally the bwlimit option's description of the 'create_vm' call gets
consistent capitalization of I/O.

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
2019-04-02 11:01:35 +02:00
Stoiko Ivanov
7e303ef3e4 bwlimit: add parameter to QemuServer::clone_disk
and pass it to qemu_drive_mirror (used for online disks).

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
2019-04-02 11:01:35 +02:00
Stoiko Ivanov
d189e5901b bwlimit: add parameter for QemuMigrate::phase2
used for online local disks via qemu_drive_mirror

Add TODO comment for offline disks, as clone_disk calls `qemu-img
convert`, which does not have a bandwidth limit parameter.

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
2019-04-02 11:00:28 +02:00
Stoiko Ivanov
15a37695b6 bwlimit: add parameter to QemuMigrate::sync_disks
used for offline migration of local volumes

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
2019-04-02 10:58:35 +02:00
Stoiko Ivanov
9fa05d31de bwlimit: add parameter to qemu_drive_mirror
used for online drive migrations, move_disk and clone calls.

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
2019-04-02 10:34:40 +02:00
Stoiko Ivanov
ddd664d739 bwlimit: honor bwlimit for migrate qmp call
The 'migrate_speed' can be set in the VM config. Additionally the 'migrate'
bwlimit from datacenter.cfg (storage-specific limits play no role for
memory+state migration) or the parameter provided to the API call can restrict
the speed. Take the lower of the two.

This patch also refactors the setting of migrate_speed and comments for clarity.

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
2019-04-02 10:34:40 +02:00
Dominik Csapak
f17fb184c6 change task name for suspend with and without disk
so that we can differentiate in the gui

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2019-03-30 14:36:50 +01:00