[pve-devel] [PATCH][pve-manager] ipv6 support on openvz container create

Игорь Шестаков shine at selectel.ru
Tue Oct 29 06:02:04 CET 2013


Require: correctly node setup(https://openvz.org/Ipv6).


On Mon, Oct 28, 2013 at 4:22 PM, Игорь Шестаков <shine at selectel.ru> wrote:

> With this patch you can set valid ipv6 address to openvz container on
> creation.
> Require package Regexp::IPv6 (cpan Regexp::IPv6)
> or debian package libregexp-ipv6-perl.
>
> diff --git a/PVE/OpenVZ.pm b/PVE/OpenVZ.pm
> index a16d4fc..bc89f50 100644
> --- a/PVE/OpenVZ.pm
> +++ b/PVE/OpenVZ.pm
> @@ -6,6 +6,7 @@ use File::stat qw();
>  use POSIX qw (LONG_MAX);
>  use IO::Dir;
>  use IO::File;
> +use Regexp::IPv6 qw($IPv6_re);
>  use PVE::Tools qw(extract_param);
>  use PVE::ProcFSTools;
>  use PVE::Cluster qw(cfs_register_file cfs_read_file);
> @@ -1064,12 +1065,16 @@ sub update_ovz_config {
>   }
>   my $newhash = {};
>   foreach my $ip (PVE::Tools::split_list($param->{'ip_address'})) {
> -    next if $ip !~ m|^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}(/\d+)?$|;
> +    if ($ip =~ m|^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}(/\d+)?$| or  $ip =~
> /^$IPv6_re$/){
>      $newhash->{$ip} = 1;
> -    if (!$iphash->{$ip}) {
> - push @$changes, '--ipadd', $ip;
> - $iphash->{$ip} = 1; # only add once
> -    }
> +     if (!$iphash->{$ip}) {
> + push @$changes, '--ipadd', $ip;
> + $iphash->{$ip} = 1; # only add once
> +     }
> + }
> + else {
> + next;
> + }
>   }
>   foreach my $ip (keys %$iphash) {
>      if (!$newhash->{$ip}) {
>
>
> --
> Igor Shestakov
>



-- 
С уважением, Шестаков Игорь
Сеть дата-центров "Селектел"
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.proxmox.com/pipermail/pve-devel/attachments/20131029/37633c09/attachment.htm>


More information about the pve-devel mailing list