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

2142 Commits

Author SHA1 Message Date
Fabian Ebner
86ea0ed0e0 Fix description for vm_config and change description for vm_pending
The description for vm_config was out of date and from the description
for vm_pending it was hard to tell what the difference to vm_config was.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2020-02-05 08:37:52 +01:00
Fabian Grünbichler
e099bad488 fixup: re-add target check
that accidentally got dropped while re-factoring previous commit

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2020-02-05 08:35:14 +01:00
Oguz Bektas
d069275fc9 fix #2578: check if $target is provided in clone
regression introduced with commit a85ff91b

previously we set $target to undef if it's localnode or localhost, then
we check if node exists.

with regression commit, behaviour changes as we do the node check in
else, but $target may be undef. this causes an error:

    no such cluster node ''

Signed-off-by: Oguz Bektas <o.bektas@proxmox.com>

improved readability

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2020-02-05 08:31:01 +01:00
Dominik Csapak
2513b862e6 fix #2566: increase scsi limit to 31
to achieve this we have to add 3 new scsihw addresses since lsi
controllers can only hold 7 scsi drives

we go up to 31, since this is the limit for virtio-scsi-single devices
we have reserved (we can increase this in the future)

to make it more future proof, we add a new pci bridge under pci
bridge 1, so we have to adapt the bridge adding code (we did not
need this for q35 previously)

impact on live migration:
since on older versions of qemu-server we do not have those config
settings, there is no problem from old -> new

new->old is not supported anyway and this breaks so that
the vm crashes and loses the configs for scsi15-30
(same behaviour as e.g. with audio0 and migration from new->old)

tested with 31 scsi disk on
i440fx + virtio-scsi
i440fx + lsi
q35 + virtio-scsi
q35 + lsi
with ovmf + seabios

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2020-01-31 20:26:26 +01:00
Dominik Csapak
844d8fa628 move the vmgenid device after readconfig on q35
and adapt the tests

this does not impact live migration, since the order here does not
change the device layout

we want this to consistently have the readconfig first

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2020-01-31 20:26:26 +01:00
Dominik Csapak
65204e922a allow reading snapshot config for VM.Audit
VM.Audit can see the current config and the list of snapshots
already, so there is no real reason to disallow
the config of snapshots

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2020-01-31 20:25:50 +01:00
Thomas Lamprecht
2dbc9ca724 bump version to 6.1-5
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-01-30 10:30:22 +01:00
Oguz Bektas
74f15a8993 hotplug_pending: make 'ssd' option non-hotpluggable
from hotplug_pending we go into 'vmconfig_update_disk', where we check the
hotpluggability of options.

add 'ssd' there as a non-hotpluggable option (since we'd have to unplug/plug to
change the drive type)

Signed-off-by: Oguz Bektas <o.bektas@proxmox.com>
2020-01-24 16:11:53 +01:00
Stefan Reiter
d786a27435 Add CPUConfig file and migrate some helpers
The package will be used for custom CPU models as a SectionConfig, hence
the name. For now we simply move some CPU related helper functions and
declarations over from QemuServer to reduce clutter there.

Exports are to avoid changing all call sites, functions have useful
names on their own.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
2020-01-22 15:47:32 +01:00
Fabian Ebner
301c675281 Use 'volname' instead of 'volid' for 'qemu_img_format'
As 'qemu_img_format' just matches a regex, this doesn't make much of
a difference, but AFAICT all other calls of 'qemu_img_format' use 'volname'.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2020-01-21 07:45:31 +01:00
Fabian Ebner
c3c5d2b6b3 Fix 2070: vm_start: for a migrating VM, use current format of disk if possible
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2020-01-21 07:45:31 +01:00
Oguz Bektas
3d48b95aa8 vmconfig_apply_pending: remove redundant write/load config calls
since we handle errors gracefully now, we don't need to write & save
config every time we change a setting.

Signed-off-by: Oguz Bektas <o.bektas@proxmox.com>
2020-01-16 10:29:31 +01:00
Thomas Lamprecht
5a7f7b99b2 qm start: document timeout default
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-01-15 17:40:12 +01:00
Tim Marx
ef3f42930f add timeout parameter to vm_start api endpoint
Signed-off-by: Tim Marx <t.marx@proxmox.com>
2020-01-15 17:36:16 +01:00
Tim Marx
2f18c84dc7 add new helper to calculate timeout based on vm config
Signed-off-by: Tim Marx <t.marx@proxmox.com>
2020-01-15 17:36:16 +01:00
Stefan Reiter
52cffab6b5 Fixup CPU flag query to not use get_basic_machine_info
get_basic_machine_info was removed by commit 045749f2fc.

Use get_host_arch to get the default machine type instead, and
optionally allow to specify architecture as parameter.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
2020-01-15 15:57:00 +01:00
Thomas Lamprecht
990b65ab60 api: vm clone: unlink zombie target config at end of error cleanup
This is the guarantee that this call operates on it's created config.
A VMID cannot be reused afterall. So only remove the guarantee at the
last step, just before throwing up the error message about the clone
failure.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-01-15 08:12:24 +01:00
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
Stefan Reiter
05a4c550f3 Add QEMU CPU flag querying helpers
* query_understood_cpu_flags returns all flags that QEMU/KVM knows about
* query_supported_cpu_flags returns all flags that QEMU/KVM can use on
  this particular host.

To get supported flags, a temporary VM is started with QEMU, so we can
issue the "query-cpu-model-expansion" QMP command. This is how libvirt
queries supported flags for its "host-passthrough" CPU type.
query_supported_cpu_flags is thus rather slow and shouldn't be called
unnecessarily.

Note that KVM and TCG accelerators provide different expansions for the
"host" CPU type, so we need to query both.

Currently only supports x86_64, because QEMU-aarch64 doesn't provide the
necessary querying functions.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
2020-01-14 11:56:21 +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
Fabian Ebner
c96173968a Remove unused 'sharedvm' variable
AFAICT this one hasn't been in use since commit
'4530494bf9f3d45c4a405c53ef3688e641f6bd8e'

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2020-01-09 17:43:51 +01:00
Oguz Bektas
4df15a0377 hotplug_pending: remove redundant write/load config calls
instead of writing the config after every change, we can do it once for
all the changes in the end to avoid redundant i/o.

we also don't need to load_config after writing fastplug changes.

Signed-off-by: Oguz Bektas <o.bektas@proxmox.com>
2019-12-20 10:51:52 +01:00
Thomas Lamprecht
9f4e1abf3b bump version to 6.1-4
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-12-16 16:03:30 +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
Thomas Lamprecht
128193e26a followup: simplify log callback
run_command only passes defined and chomped strings to the callback,
so no need to do that twice.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-12-12 13:39:04 +01:00
Stefan Reiter
8bf30c2a72 fix #2493: show QEMU errors in migration log
QEMU usually only prints warnings and errors and stays silent otherwise,
so it makes sense to just log all of it's output.

Prefix it with '[<target_hostname>]' to indicate that the output is
coming from the remote node, so users know where to search for the
error.

Side effect is that the 'VM start' task created by the migration will
now show the "QEMU:" prefix, but it's still very readable IMHO.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
2019-12-12 13:36:19 +01:00
Stefan Reiter
6e0216d862 hide long commandline on vm_start/migrate failure
By default run_command prints the entire commandline executed when an
error occurs, but QEMU and our migrate command are not only
uninteresting to the user[*] but also annoyingly long. Hide them and only
print the exit code.

[*] Especially our migrate command, since it can't be manually executed
anyway. QEMU's commandline *might* contain something interesting, but is
so long that it's tricky to parse anyway, any a user can always call 'qm
showcmd --pretty'.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
2019-12-12 13:35:40 +01:00
Stefan Reiter
68b108ee3a update disk size before local disk migration
Split out 'update_disksize' from the renamed 'update_disk_config' to
allow code reuse in QemuMigrate.

Remove dots after messages to keep style consistent for migration log.

After updating in sync_disks (phase1) of migration, write out updated
config. This means that even if migration fails or is aborted in later
stages, we keep the fixed config - this is not an issue, as it would
have been fixed on the next attempt anyway, and it can't hurt to have
the correct size instead of a wrong one either way.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
2019-12-11 10:42: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
Dominik Csapak
66cebc4671 refactor finding of vmstate storage
we need that on another place, so refactor in its own sub

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
Thomas Lamprecht
a546da0319 cfg2cmd: allow to test for expected error messages
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-12-10 11:08:33 +01:00
Thomas Lamprecht
38277afcd4 qemu-server: make nodename mock-able for tests
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-12-10 11:08:33 +01:00
Thomas Lamprecht
cbb39a7e79 followup: improve error message for outdated QEMU version
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-12-10 11:08:33 +01:00
Stefan Reiter
a77a53ae54 check if QEMU version is recent enough for machine type
...and show the user a more meaningful error otherwise.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
2019-12-10 09:13:33 +01:00
Thomas Lamprecht
00a2baa5f4 bump version to 6.1-3
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-12-09 11:44:40 +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
Stefan Reiter
6db4c69e1d cfg2cmd: test runs_at_least_qemu_version and version_cmp explicitly
Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
2019-12-09 11:42:49 +01:00
Stefan Reiter
8b26544e50 cfg2cmd: minor cleanup
We never shipped a 4.1.0 QEMU, so it makes more sense to test as 4.1.1

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
2019-12-09 11:42:49 +01:00
Thomas Lamprecht
c7728fdb85 followup: minor cleanup/error message spelling
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-12-09 11:30:14 +01:00
Dominik Csapak
844b55fb89 fix #2510: hostpci: always check if device exists
if the user set a device as hostpci with the 'shorthand' syntax:

hostpciX: 00:12

we ignored it on starting and showcmd and continued.
Since the user explicitly wanted to passthrough a device, we now check
if there is actually a device with that id

for explicitly configured devices (00:12.1), we did not check if it exists,
but the kvm call failed with a non-obvious error message

now we always call 'lspci' from SysFSTools to check if it actually exists,
and fail if not. With this, we can drop the workaround for adding
'0000' if no domain was given, since lspci does it already for us

this fixes #2510, an issue with using mediated devices where the users did not have
the domain in the config, since we forgot to add the default domain there

the only issue with this patch is that it changes the behaviour of
'showcmd' slightly, as in now, we die if the device was explicitly
given, but did not exists (we showed the commandline, now we fail)

this also slightly changes the commandline for qemu (adding always
the domain), which is not a problem since we cannot live migrate
or snapshot such vms, but we have to adapt the tests

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2019-12-09 11:30:14 +01:00
Dominik Csapak
0360faadc7 cfg2cmd test: add tests for multifunction devices
by mocking the lspci call

the mocked lspci code is basically the same as the real one,
only difference is the source of the devices and
there is no verbose flag

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2019-12-09 11:30:14 +01:00
Thomas Lamprecht
db40988ec9 Revert "fix #2478: record python3-minimal as build dependency"
This reverts commit 951b1783cdd328990b46b47a60a457e5acc33cb0.
2019-12-09 10:32:46 +01:00
Thomas Lamprecht
bdd1feef5b fix #2469: fix qemu-img convert src_format detection
This reverts commit c5151cb8bb5f919c9e621065224c3d455b60f833 which is
a revert of the wrongly done revert of
commit e2414e73ce75893a143dc32cf6a4e58159cc25ff.
2019-12-09 10:31:33 +01:00
Thomas Lamprecht
340dbcf730 create_efidisk: poll the real size after volume creation
some storage backends have bigger granularity than the default 128k
size from the EFIVARS template file, so we actually need to poll the
real created disk size, as it will be used to create the target
volume for local storage migration on running VMs, if it's to small
the target will be to small and migration will fail.

Just a fix for newly created EFIDISKS, for others we need to rescan
the size after we've got the migrate lock and write the updated info
out, so that the target node has the correct one (protected from
migrate lock).

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-12-04 18:42:27 +01:00
Thomas Lamprecht
dad06e2068 refactor storage whitelist in sync_disks to regex
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-12-04 18:40:03 +01:00
Thomas Lamprecht
4c2f3755c7 bump version to 6.1-2
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-11-30 18:38:50 +01:00