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>