ALT Linux Bugzilla
– Attachment 6812 Details for
Bug 32462
Контейнеры на базе ALT Linux неработоспособны
New bug
|
Search
|
[?]
|
Help
Register
|
Log In
[x]
|
Forgot Password
Login:
[x]
|
EN
|
RU
[patch]
Поддержка контейнеров на базе альта.
pve.patch (text/plain), 8.05 KB, created by
Вадим Илларионов
on 2016-09-04 18:22:17 MSK
(
hide
)
Description:
Поддержка контейнеров на базе альта.
Filename:
MIME Type:
Creator:
Вадим Илларионов
Created:
2016-09-04 18:22:17 MSK
Size:
8.05 KB
patch
obsolete
>--- /usr/share/perl5/PVE/LXC.pm.orig 2016-08-12 15:37:00.000000000 +0800 >+++ /usr/share/perl5/PVE/LXC.pm 2016-09-04 20:24:58.018679329 +0800 >@@ -346,7 +346,7 @@ > my $custom_idmap = grep { $_->[0] eq 'lxc.id_map' } @{$conf->{lxc}}; > > my $ostype = $conf->{ostype} || die "missing 'ostype' - internal error"; >- if ($ostype =~ /^(?:debian | ubuntu | centos | fedora | opensuse | archlinux | alpine | gentoo | unmanaged)$/x) { >+ if ($ostype =~ /^(?:debian | ubuntu | centos | fedora | oracle | opensuse | altlinux | archlinux | alpine | gentoo | unmanaged)$/x) { > my $inc ="/usr/share/lxc/config/$ostype.common.conf"; > $inc ="/usr/share/lxc/config/common.conf" if !-f $inc; > $raw .= "lxc.include = $inc\n"; >--- /usr/share/perl5/PVE/LXC/Config.pm.orig 2016-08-12 15:37:00.000000000 +0800 >+++ /usr/share/perl5/PVE/LXC/Config.pm 2016-09-04 19:48:58.022562159 +0800 >@@ -289,7 +289,7 @@ > ostype => { > optional => 1, > type => 'string', >- enum => [qw(debian ubuntu centos fedora opensuse archlinux alpine gentoo unmanaged)], >+ enum => [qw(debian ubuntu centos fedora oralce opensuse altlinux archlinux alpine gentoo unmanaged)], > description => "OS type. This is used to setup configuration inside the container, and corresponds to lxc setup scripts in /usr/share/lxc/config/<ostype>.common.conf. Value 'unmanaged' can be used to skip and OS specific setup.", > }, > console => { >--- /usr/share/perl5/PVE/LXC/Setup.pm.orig 2016-08-12 15:37:00.000000000 +0800 >+++ /usr/share/perl5/PVE/LXC/Setup.pm 2016-09-04 12:19:00.000000000 +0800 >@@ -13,6 +13,8 @@ > use PVE::LXC::Setup::ArchLinux; > use PVE::LXC::Setup::Alpine; > use PVE::LXC::Setup::Gentoo; >+use PVE::LXC::Setup::Oracle; >+use PVE::LXC::Setup::ALTLinux; > > my $plugins = { > debian => 'PVE::LXC::Setup::Debian', >@@ -23,6 +25,8 @@ > archlinux => 'PVE::LXC::Setup::ArchLinux', > alpine => 'PVE::LXC::Setup::Alpine', > gentoo => 'PVE::LXC::Setup::Gentoo', >+ oracle => 'PVE::LXC::Setup::Oracle', >+ altlinux => 'PVE::LXC::Setup::ALTLinux', > }; > > my $autodetect_type = sub { >@@ -40,6 +44,10 @@ > return "debian"; > } elsif (-f "$rootdir/etc/SuSE-brand" || -f "$rootdir/etc/SuSE-release") { > return "opensuse"; >+ } elsif (-f "$rootdir/etc/altlinux-release") { >+ return "altlinux"; >+ } elsif (-f "$rootdir/etc/oracle-release") { >+ return "oracle"; > } elsif (-f "$rootdir/etc/fedora-release") { > return "fedora"; > } elsif (-f "$rootdir/etc/centos-release" || -f "$rootdir/etc/redhat-release") { >--- /usr/share/perl5/PVE/LXC/Setup/Oracle.pm.orig 2016-09-04 20:08:26.513342202 +0800 >+++ /usr/share/perl5/PVE/LXC/Setup/Oracle.pm 2016-09-04 12:10:52.883705657 +0800 >@@ -0,0 +1,24 @@ >+package PVE::LXC::Setup::Oracle; >+ >+use strict; >+use warnings; >+use PVE::LXC::Setup::CentOS; >+use base qw(PVE::LXC::Setup::CentOS); >+ >+sub new { >+ my ($class, $conf, $rootdir) = @_; >+ my $release = PVE::Tools::file_read_firstline("$rootdir/etc/oracle-release"); >+ die "unable to read version info\n" if !defined($release); >+ my $version; >+ if ($release =~ m/release\s+(\d+\.\d+)(\.\d+)?/){ >+ if ($1 >= 6 && $1 < 8){ >+ $version = $1; >+ } >+ } >+ die "unsupported oracle release '$release'\n" if !$version; >+ my $self = { conf => $conf, rootdir => $rootdir, version => $version }; >+ $conf->{ostype} = "oracle"; >+ return bless $self, $class; >+} >+ >+1; >--- /usr/share/perl5/PVE/LXC/Setup/ALTLinux.pm.orig 2016-09-04 20:08:26.513342202 +0800 >+++ /usr/share/perl5/PVE/LXC/Setup/ALTLinux.pm 2016-09-04 16:22:00.000000000 +0800 >@@ -0,0 +1,95 @@ >+package PVE::LXC::Setup::ALTLinux; >+ >+use strict; >+use warnings; >+use PVE::LXC::Setup::Base; >+use base qw(PVE::LXC::Setup::Base); >+ >+sub new { >+ my $ostype = "altlinux"; >+ my ($class, $conf, $rootdir) = @_; >+ my $version = PVE::Tools::file_read_firstline("$rootdir/etc/$ostype-release"); >+ my $self = { conf => $conf, rootdir => $rootdir, version => $version }; >+ $conf->{ostype} = $ostype; >+ return bless $self, $class; >+} >+ >+sub set_hostname { >+ my ($self, $conf) = @_; >+ # Redhat wants the fqdn in /etc/sysconfig/network's HOSTNAME >+ my $hostname = $conf->{hostname} || 'localhost'; >+ my $sysconfig_network = "/etc/sysconfig/network"; >+ my $oldname; >+ my $data = $self->ct_file_get_contents($sysconfig_network); >+ if ($data =~ m/^HOSTNAME=\s*(\S+)\s*$/m){ >+ $oldname = $1; >+ } >+ my $hosts_fn = "/etc/hosts"; >+ my ($ipv4, $ipv6) = PVE::LXC::get_primary_ips($conf); >+ my $hostip = $ipv4 || $ipv6; >+ my ($searchdomains) = $self->lookup_dns_conf($conf); >+ $self->update_etc_hosts($hostip, $oldname, $hostname, $searchdomains); >+ if ($self->ct_file_exists($sysconfig_network)){ >+ my $data = $self->ct_file_get_contents($sysconfig_network); >+ if ($data !~ s/^HOSTNAME=\h*(\S+)\h*$/HOSTNAME=$hostname/m){ >+ $data .= "HOSTNAME=$hostname\n"; >+ } >+ $self->ct_file_set_contents($sysconfig_network, $data); >+ } >+} >+ >+sub setup_init { >+ my ($self, $conf) = @_; >+ my $filename = "/etc/inittab"; >+ return if !$self->ct_file_exists($filename); >+ my $ttycount = PVE::LXC::Config->get_tty_count($conf); >+ my $inittab = $self->ct_file_get_contents($filename); >+ my @lines = grep { >+ # remove getty lines >+ !/^\s*\d+:\d+:[^:]*:.*getty/ && >+ # remove power lines >+ !/^\s*p[fno0]:/ >+ } split(/\n/, $inittab); >+ $inittab = join("\n", @lines) . "\n"; >+ $inittab .= "p0::powerfail:/sbin/shutdown -f -h +2 \"Power failure, system shutting down...\"\n"; >+ for (my $id = 1; $id <= $ttycount; $id++){ >+ next if $id == 7; # reserved for X11 >+ my $levels = ($id == 1) ? '234' : '2345'; >+ $inittab .= "$id:$levels:respawn:/sbin/mingetty tty$id\n"; >+ } >+ $self->ct_file_set_contents($filename, $inittab); >+} >+ >+sub setup_network { >+ my ($self, $conf) = @_; >+# my $gw; >+ foreach my $k (keys %$conf) { >+ next if $k !~ m/^net(\d+)$/; >+ my $d = PVE::LXC::Config->parse_lxc_network($conf->{$k}); >+ next if !$d->{name}; >+ my $ifpath = "/etc/net/ifaces/$d->{name}"; >+ $self->ct_make_path($ifpath); >+ my $optfile = "$ifpath/options"; >+ my $addrfile = "$ifpath/ipv4address"; >+ my $routefile = "$ifpath/ipv4route"; >+ my $options = "TYPE=eth\n"; >+ my $address = ''; >+ my $routes = ''; >+ if ($d->{ip} && $d->{ip} ne 'manual'){ >+ if ($d->{ip} eq 'dhcp'){ >+ $options .= "BOOTPROTO=dhcp\n"; >+ } else { >+ $options .= "BOOTPROTO=static\n"; >+ $address = "$d->{ip}\n"; >+ if (defined($d->{gw})){ >+ $routes .= "default via $d->{gw}\n"; >+ $self->ct_modify_file($routefile, $routes, delete => 1, prepend => 1); >+ } >+ $self->ct_file_set_contents($addrfile, $address); >+ } >+ $self->ct_file_set_contents($optfile, $options); >+ } >+ } >+} >+ >+1; >--- /usr/share/lxc/config/altlinux.common.conf.orig 2016-09-04 20:41:52.936575330 +0800 >+++ /usr/share/lxc/config/altlinux.common.conf 2016-09-04 16:28:52.853163506 +0800 >@@ -0,0 +1,27 @@ >+# This derives from the global common config >+lxc.include = /usr/share/lxc/config/common.conf >+ >+# Allow for 6 tty devices by default >+lxc.tty = 6 >+ >+# Doesn't support consoles in /dev/lxc/ >+#lxc.devttydir = >+ >+# Capabilities >+# Uncomment these if you don't run anything that needs the capability, and >+# would like the container to run with less privilege. >+# >+# Dropping sys_admin disables container root from doing a lot of things >+# that could be bad like re-mounting lxc fstab entries rw for example, >+# but also disables some useful things like being able to nfs mount, and >+# things that are already namespaced with ns_capable() kernel checks, like >+# hostname(1). >+# lxc.cap.drop = sys_admin >+# lxc.cap.drop = net_raw # breaks dhcp/ping >+# lxc.cap.drop = setgid # breaks login (initgroups/setgroups) >+# lxc.cap.drop = dac_read_search # breaks login (pam unix_chkpwd) >+# lxc.cap.drop = setuid # breaks sshd,nfs statd >+# lxc.cap.drop = audit_control # breaks sshd (set_loginuid failed) >+# lxc.cap.drop = audit_write >+# lxc.cap.drop = setpcap # big big login delays in Fedora 20 systemd >+lxc.cap.drop = setfcap sys_nice sys_pacct sys_rawio >--- /usr/share/lxc/config/altlinux.userns.conf.orig 2016-09-04 20:41:46.686575161 +0800 >+++ /usr/share/lxc/config/altlinux.userns.conf 2016-08-23 02:13:41.000000000 +0800 >@@ -0,0 +1,2 @@ >+# This derives from the global userns config >+lxc.include = /usr/share/lxc/config/userns.conf
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 32462
: 6812