log_warn($warning) if defined($raw) && length($raw) > $max_length;
}
-sub check_description_lengths {
+sub check_node_and_guest_configurations {
log_info("Checking node and guest description/note legnth..");
my @affected_nodes = grep {
log_pass("All node config descriptions fit in the new limit of 64 KiB");
}
- my $affected_guests = [];
+ my $affected_guests_long_desc = [];
+ my $affected_cts_cgroup_keys = [];
my $cts = PVE::LXC::config_list();
for my $vmid (sort { $a <=> $b } keys %$cts) {
- my $desc = PVE::LXC::Config->load_config($vmid)->{description};
- push @$affected_guests, "CT $vmid" if defined($desc) && length($desc) > 8 * 1024;
+ my $conf = PVE::LXC::Config->load_config($vmid);
+
+ my $desc = $conf->{description};
+ push @$affected_guests_long_desc, "CT $vmid" if defined($desc) && length($desc) > 8 * 1024;
+
+ my $lxc_raw_conf = $conf->{lxc};
+ push @$affected_cts_cgroup_keys, "CT $vmid" if (grep (@$_[0] =~ /^lxc\.cgroup\./, @$lxc_raw_conf));
}
my $vms = PVE::QemuServer::config_list();
for my $vmid (sort { $a <=> $b } keys %$vms) {
my $desc = PVE::QemuConfig->load_config($vmid)->{description};
- push @$affected_guests, "VM $vmid" if defined($desc) && length($desc) > 8 * 1024;
+ push @$affected_guests_long_desc, "VM $vmid" if defined($desc) && length($desc) > 8 * 1024;
}
- if (scalar($affected_guests->@*) > 0) {
+ if (scalar($affected_guests_long_desc->@*) > 0) {
log_warn("Guest config description of the following virtual-guests too long for new limit of 64 KiB:\n"
- ." * " . join("\n * ", $affected_guests->@*));
+ ." " . join(", ", $affected_guests_long_desc->@*));
} else {
log_pass("All guest config descriptions fit in the new limit of 8 KiB");
}
+
+ log_info("Checking container configs for deprecated lxc.cgroup entries");
+
+ if (scalar($affected_cts_cgroup_keys->@*) > 0) {
+ if ($forced_legacy_cgroup) {
+ log_pass("Found legacy 'lxc.cgroup' keys, but system explicitly configured for legacy hybrid cgroup hierarchy.");
+ } else {
+ log_warn("The following CTs have 'lxc.cgroup' keys configured, which will be ignored in the new default unified cgroupv2:\n"
+ ." " . join(", ", $affected_cts_cgroup_keys->@*) ."\n"
+ ." Often it can be enough to change to the new 'lxc.cgroup2' prefix after the upgrade to Proxmox VE 7.x");
+ }
+ } else {
+ log_pass("No legacy 'lxc.cgroup' keys found.");
+ }
}
sub check_storage_content {
log_info("Checking storage content type configuration..");
- my $found_referenced;
- my $found_unreferenced;
+ my $found;
my $pass = 1;
my $storage_cfg = PVE::Storage::config();
- my $potentially_affected = {};
- my $referenced_volids = {};
-
for my $storeid (sort keys $storage_cfg->{ids}->%*) {
my $scfg = $storage_cfg->{ids}->{$storeid};
+ next if $scfg->{shared};
next if !PVE::Storage::storage_check_enabled($storage_cfg, $storeid, undef, 1);
my $valid_content = PVE::Storage::Plugin::valid_content_types($scfg->{type});
delete $scfg->{content}->{none}; # scan for guest images below
}
- next if $scfg->{content}->{images} && $scfg->{content}->{rootdir};
+ next if $scfg->{content}->{images};
+ next if $scfg->{content}->{rootdir};
# Skip 'iscsi(direct)' (and foreign plugins with potentially similiar behavior) with 'none',
# because that means "use LUNs directly" and vdisk_list() in PVE 6.x still lists those.
}
my @volids = map { $_->{volid} } $res->{$storeid}->@*;
- for my $volid (@volids) {
- $potentially_affected->{$volid} = 1;
- }
-
my $number = scalar(@volids);
- if ($number > 0 && !$scfg->{content}->{images} && !$scfg->{content}->{rootdir}) {
+ if ($number > 0) {
log_info("storage '$storeid' - neither content type 'images' nor 'rootdir' configured"
.", but found $number guest volume(s)");
}
my $check_volid = sub {
my ($volid, $vmid, $vmtype, $reference) = @_;
- $referenced_volids->{$volid} = 1 if $reference ne 'unreferenced';
-
my $guesttext = $vmtype eq 'qemu' ? 'VM' : 'CT';
my $prefix = "$guesttext $vmid - volume '$volid' ($reference)";
}
if (!$scfg->{content}->{$vtype}) {
- $found_referenced = 1 if $reference ne 'unreferenced';
- $found_unreferenced = 1 if $reference eq 'unreferenced';
+ $found = 1;
$pass = 0;
log_warn("$prefix - storage does not have content type '$vtype' configured.");
}
};
- my $guests = {};
-
my $cts = PVE::LXC::config_list();
for my $vmid (sort { $a <=> $b } keys %$cts) {
- $guests->{$vmid} = 'lxc';
-
my $conf = PVE::LXC::Config->load_config($vmid);
my $volhash = {};
my $vms = PVE::QemuServer::config_list();
for my $vmid (sort { $a <=> $b } keys %$vms) {
- $guests->{$vmid} = 'qemu';
-
my $conf = PVE::QemuConfig->load_config($vmid);
my $volhash = {};
}
}
- if ($found_referenced) {
+ if ($found) {
log_warn("Proxmox VE 7.0 enforces stricter content type checks. The guests above " .
"might not work until the storage configuration is fixed.");
}
- for my $volid (sort keys $potentially_affected->%*) {
- next if $referenced_volids->{$volid}; # already checked
-
- my (undef, undef, $vmid) = PVE::Storage::parse_volname($storage_cfg, $volid);
- my $vmtype = $guests->{$vmid};
- next if !$vmtype;
-
- $check_volid->($volid, $vmid, $vmtype, 'unreferenced');
- }
-
- if ($found_unreferenced) {
- log_warn("When migrating, Proxmox VE 7.0 only scans storages with the appropriate " .
- "content types for unreferenced guest volumes.");
- }
-
if ($pass) {
log_pass("no problems found");
}
}
};
-sub check_lxc_conf_keys {
- my $kernel_cli = PVE::Tools::file_get_contents('/proc/cmdline');
- if ($kernel_cli =~ /systemd.unified_cgroup_hierarchy=0/){
- log_skip("System explicitly configured for legacy hybrid cgroup hierarchy.");
- return;
- }
+sub check_security_repo {
+ log_info("Checking if the suite for the Debian security repository is correct..");
- log_info("Checking container configs for deprecated lxc.cgroup entries");
+ my $found = 0;
- my $affected_ct = [];
- my $cts = PVE::LXC::config_list();
- for my $vmid (sort { $a <=> $b } keys %$cts) {
- my $lxc_raw_conf = PVE::LXC::Config->load_config($vmid)->{lxc};
- push @$affected_ct, "CT $vmid" if (grep (@$_[0] =~ /^lxc\.cgroup\./, @$lxc_raw_conf));
- }
- if (scalar($affected_ct->@*) > 0) {
- log_warn("Config of the following containers contains 'lxc.cgroup' keys, which will be ".
- "ignored in a unified cgroupv2 system:\n" .
- join(", ", $affected_ct->@*));
- } else {
- log_pass("No legacy 'lxc.cgroup' keys found.");
+ my $dir = '/etc/apt/sources.list.d';
+ my $in_dir = 0;
+
+ my $check_file = sub {
+ my ($file) = @_;
+
+ $file = "${dir}/${file}" if $in_dir;
+
+ my $raw = eval { PVE::Tools::file_get_contents($file) };
+ return if !defined($raw);
+ my @lines = split(/\n/, $raw);
+
+ my $number = 0;
+ for my $line (@lines) {
+ $number++;
+
+ next if length($line) == 0; # split would result in undef then...
+
+ ($line) = split(/#/, $line);
+
+ next if $line !~ m/^deb[[:space:]]/; # is case sensitive
+
+ my $suite;
+
+ # catch any of
+ # https://deb.debian.org/debian-security
+ # http://security.debian.org/debian-security
+ # http://security.debian.org/
+ if ($line =~ m|https?://deb\.debian\.org/debian-security/?\s+(\S*)|i) {
+ $suite = $1;
+ } elsif ($line =~ m|https?://security\.debian\.org(?:.*?)\s+(\S*)|i) {
+ $suite = $1;
+ } else {
+ next;
+ }
+
+ $found = 1;
+
+ my $where = "in ${file}:${number}";
+
+ if ($suite eq 'buster/updates') {
+ log_info("Make sure to change the suite of the Debian security repository " .
+ "from 'buster/updates' to 'bullseye-security' - $where");
+ } elsif ($suite eq 'bullseye-security') {
+ log_pass("already using 'bullseye-security'");
+ } else {
+ log_fail("The new suite of the Debian security repository should be " .
+ "'bullseye-security' - $where");
+ }
+ }
+ };
+
+ $check_file->("/etc/apt/sources.list");
+
+ $in_dir = 1;
+
+ PVE::Tools::dir_glob_foreach($dir, '^.*\.list$', $check_file);
+
+ if (!$found) {
+ # only warn, it might be defined in a .sources file or in a way not catched above
+ log_warn("No Debian security repository detected in /etc/apt/sources.list and " .
+ "/etc/apt/sources.list.d/*.list");
}
}
check_backup_retention_settings();
check_cifs_credential_location();
check_custom_pool_roles();
- check_description_lengths();
+ check_node_and_guest_configurations();
check_storage_content();
- check_lxc_conf_keys();
+ check_security_repo();
}
__PACKAGE__->register_method ({