fix the fix for #1024
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
(cherry picked from commit e7fe107f75ee1bb9877b0d6430489661d6c1beea)
If on bootup one of our VMs is locked by an backup we safely can
assume that this backup job does not run anymore and that the lock
has no reason anymore and just hinders uptime of services.
As at this time we (the node) have quorum so we may safely assume
that we have a consistent view of the cluster and all our VMs really
belong to us. We just need to ensure that we do not run into an
automatic backup jobs, so execute our code with VZDumps lock or
timeout.
Log in the Task and Sys log that we removed the lock, so that an
admin easily sees that there may be need for cleaning leftovers from
an interrupted backup.
Addresses bug #1024
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
(cherry picked from commit 248b2d361407d07b6d41138ab2912b6a0e66ae6d)
small refactoring in get_filtered_vmlist: save a VMs config in its
own subhash to avoid collisions with other data which we want to save
in the vmid list, for now this is only `type` but in the next patch
I want to save also the class
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
(cherry picked from commit 627fa10467a1578c5a3c7d2a292bbe6f14a881ca)
since bash does not play well with utf8 encoded input,
eg. pressing ALTGR + M on an english intl keyboard layout int novnc
does not enter the mu symbol but makes bash think you pressed alt+5,
we should use login without authorization when logging in as root
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
use the new keeplocale parameter from run_command and do not delete the
LANG and LANGUAGE variable for the vncshell
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
instead of using get_start_stop_list in a rather hacky way use the
new get_filtered_vmlist method and adapt the loop, as now only one
level is required.
most changes are just an indent shift left as we lost an unnecessary
loop level
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
we used get_start_stop_list for assembling a list of VMIDs for
stopall, startall and migrateall.
While get_start_stop_list did already some filtering we did some
more in the specific startall and stopall calls.
Add a new private helper which does all the filtering and just
assemble the startup order in the get_start_stop_list method.
Move the template and ha managed filtering in the new
get_filtered_vmlist method, this allows us to remove the filtering
from the API calls them self and we do not load the vms config twice
(it was cached, but nonetheless unnecessary)
get_filtered_vmlist is also intended to be used by migrateall in a
next patch
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
this is a simple filter which allows us to limit the actions to specific
vmids
this makes it much simpler to start/stop/migrate a range of vms
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
removes the check for dir or nfs storage,
because a few lines below we check for
the content type vztmpl
which should only be allowed when we have a
location where we put templates, thus we should
be able to download them there
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
Refactored and now using PVE::QemuConfig and PVE::LXC::Config
Moved the next if.. statements into the corresponding branches
Signed-off-by: Caspar Smit <casparsmit@supernas.eu>
Reviewed-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
allow the since/until parameters which journalctl understands
We use a really simple regex to check a valit date (time) stamp.
This can be done as this API call gets mainly used by the GUI where
we have full controll over what we send and additional journalctl
has already a good timestamp parser which can handle that.
If set limit the maximal worker count to the new datacenter.cfg
setting 'max_workers'.
For stopall we prefer this over the cpu count if it's set.
For migrateall we prefer the parameter but allow now to ommit
the parameter and then we use the new setting if set.
if both are not set we throw an error.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Previously we waited 10 seconds, in PVE 4 system sometimes need more
time to initialize all services so the didn't execute the startall
command even if a few seconds later cfs quorum was etablished.
This is a background process started from the pve-manager init
script, thus waiting doesn't interferes with other processes, so
wait long enough.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
The check used was completely wrong and so the startall and stopall
API calls touched HA managed service, which they shouldn't.
Using the vm_is_ha_managed call from the HA stack fixes that.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
When adding the new LXC config format we forgot to adapt the
get_start_stop_list and do s/pve.startup/onboot/
This fixes that qemu VMs were started always before LXC CTs,
irregardless of the defined order.
This also let's us simplify the surrounding code and reduce code
reuse.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>