[pve-devel] [PATCH] fix hotplug ip configuration

Alexandre DERUMIER aderumier at odiso.com
Mon Jun 29 16:46:01 CEST 2015


>>But why do you set $rest to '{}', instead of ''? 
>>And I think the resulting value starts with ','? 

oh,yes, don't known what I have done here... 
I think I have mixed print_lxc_network and parse_lxc_network, ... sorry ...


maybe simply

sub print_lxc_network {
    my ($data) = @_;

    die "no network name defined\n" if !$net->{name};

    my $res = "name=$net->{name}";
 
    foreach my $k (qw(bridge hwaddr mtu ip gw ip6 gw6 firewall tag)) {
    ....
}


as name is mandatory



----- Mail original -----
De: "dietmar" <dietmar at proxmox.com>
À: "aderumier" <aderumier at odiso.com>
Cc: "pve-devel" <pve-devel at pve.proxmox.com>
Envoyé: Lundi 29 Juin 2015 16:03:23
Objet: Re: [pve-devel] [PATCH] fix hotplug ip configuration

> On June 29, 2015 at 2:09 PM Alexandre DERUMIER <aderumier at odiso.com> wrote: 
> 
> 
> >>> - die "no network bridge defined\n" if !$net->{bridge}; 
> >>> - 
> >>> - my $res = "bridge=$net->{bridge}"; 
> >>> + my $res = {}; 
> > 
> >why? 
> 
> In case we want to switch to a new bridge, and a failure occur 
> 
> - unplug tap from initial bridge 
> 
> write config 
> 
> - plug tap to new bridge ->failed 
> 
> 
> Technically, it's not a problem to have a veth not plugged in a bridge. 

But why do you set $rest to '{}', instead of ''? 

And I think the resulting value starts with ','? 

> 
> 
> 
> 
> 
> ----- Mail original ----- 
> De: "dietmar" <dietmar at proxmox.com> 
> À: "aderumier" <aderumier at odiso.com>, "pve-devel" <pve-devel at pve.proxmox.com> 
> Envoyé: Lundi 29 Juin 2015 12:43:12 
> Objet: Re: [pve-devel] [PATCH] fix hotplug ip configuration 
> 
> > diff --git a/src/PVE/LXC.pm b/src/PVE/LXC.pm 
> > index 76c512d..2b7069b 100644 
> > --- a/src/PVE/LXC.pm 
> > +++ b/src/PVE/LXC.pm 
> > @@ -775,11 +775,9 @@ sub vmstatus { 
> > sub print_lxc_network { 
> > my $net = shift; 
> > 
> > - die "no network bridge defined\n" if !$net->{bridge}; 
> > - 
> > - my $res = "bridge=$net->{bridge}"; 
> > + my $res = {}; 
> 
> why? 
> 
> > 
> > - foreach my $k (qw(hwaddr mtu name ip gw ip6 gw6 firewall tag)) { 
> > + foreach my $k (qw(bridge hwaddr mtu name ip gw ip6 gw6 firewall tag)) { 
> > next if !defined($net->{$k}); 
> > $res .= ",$k=$net->{$k}"; 
> > } 
> > @@ -852,6 +850,19 @@ sub find_lxc_console_pids { 
> > return $res; 
> > } 
> > 
> 
> 



More information about the pve-devel mailing list