[pve-devel] [PATCH 2/3] Skip templates when using the start all VMs button
Caspar Smit
casparsmit at supernas.eu
Fri Mar 11 14:25:12 CET 2016
Hi Fabian,
Thank you for clarifying, i missed the refactoring as i created the patches
a while back. I'm rather new to git so excuse me for that.
I hope you'll get the idea what i'm trying to achieve here. Right now the
start-all button also starts templates and throws an error for each VM/CT
template because it cannot start, obviously.
Kind regards,
Caspar Smit
2016-03-11 13:15 GMT+01:00 Fabian Grünbichler <f.gruenbichler at proxmox.com>:
> > Caspar Smit <casparsmit at supernas.eu> hat am 11. März 2016 um 12:59
> > geschrieben:
> >
> >
> > Signed-off-by: Caspar Smit <casparsmit at supernas.eu>
> > ---
> > PVE/API2/Nodes.pm | 12 ++++++++++++
> > 1 file changed, 12 insertions(+)
> >
> > diff --git a/PVE/API2/Nodes.pm b/PVE/API2/Nodes.pm
> > index d4af788..6f639d2 100644
> > --- a/PVE/API2/Nodes.pm
> > +++ b/PVE/API2/Nodes.pm
> > @@ -1274,6 +1274,18 @@ __PACKAGE__->register_method ({
> > foreach my $vmid (sort {$a <=> $b} keys %$vmlist) {
> > my $d = $vmlist->{$vmid};
> >
> > + # skip templates
> > + my $conf;
> > + if ($d->{type} eq 'lxc') {
> > + $conf = PVE::LXC::load_config($vmid);
> > + } elsif ($d->{type} eq 'qemu') {
> > + $conf = PVE::QemuServer::load_config($vmid);
> > + } else {
> > + die "unknown VM type '$d->{type}'\n";
> > + }
> > + next if PVE::QemuServer::is_template($conf);
> > + next if PVE::LXC::is_template($conf);
> > +
> > PVE::Cluster::check_cfs_quorum(); # abort when we
> loose quorum
> >
> > eval {
> > --
> > 2.1.4
> >
>
> PVE::LXC::load_config and PVE::QemuServer::load:config were refactored to
> pve-common/src/pve/AbstractConfig.pm (PVE::AbstractConfig,
> implemented/extended
> in PVE::LXC::Config and PVE::QemuConfig), so these should be called via the
> respective subclasses PVE::LXC::Config->load_config and
> PVE::QemuConfig->load_config. The same applies for is_template.
>
> The is_template check should move into the if branches, it doesn't make
> sense to
> check this twice, especially since both subclasses use the implementation
> in
> AbstractConfig.pm anyway.
>
> I'll leave the general review to the others - thanks for you contribution
> in any
> case!
>
> Regards,
> Fabian
>
> _______________________________________________
> pve-devel mailing list
> pve-devel at pve.proxmox.com
> http://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.proxmox.com/pipermail/pve-devel/attachments/20160311/aee5e2e7/attachment.htm>
More information about the pve-devel
mailing list