delete $snap->{$remove_drive};
$class->add_unused_volume($snap, $mountpoint->{volume})
- if ($mountpoint->{type} eq 'volume');
+ if $mountpoint && ($mountpoint->{type} eq 'volume');
}
}
}
sub __snapshot_rollback_vol_possible {
- my ($class, $mountpoint, $snapname) = @_;
+ my ($class, $mountpoint, $snapname, $blockers) = @_;
my $storecfg = PVE::Storage::config();
- PVE::Storage::volume_rollback_is_possible($storecfg, $mountpoint->{volume}, $snapname);
+ PVE::Storage::volume_rollback_is_possible(
+ $storecfg,
+ $mountpoint->{volume},
+ $snapname,
+ $blockers,
+ );
}
sub __snapshot_rollback_vol_rollback {
cfs_register_file('/lxc/', \&parse_pct_config, \&write_pct_config);
-my $valid_mount_option_re = qr/(noatime|nodev|nosuid|noexec)/;
+my $valid_mount_option_re = qr/(noatime|lazytime|nodev|nosuid|noexec)/;
sub is_valid_mount_option {
my ($option) = @_;
optional => 1,
});
+# IP address with optional interface suffix for link local ipv6 addresses
+PVE::JSONSchema::register_format('lxc-ip-with-ll-iface', \&verify_ip_with_ll_iface);
+sub verify_ip_with_ll_iface {
+ my ($addr, $noerr) = @_;
+
+ if (my ($addr, $iface) = ($addr =~ /^(fe80:[^%]+)%(.*)$/)) {
+ if (PVE::JSONSchema::pve_verify_ip($addr, 1)
+ && PVE::JSONSchema::pve_verify_iface($iface, 1))
+ {
+ return $addr;
+ }
+ }
+
+ return PVE::JSONSchema::pve_verify_ip($addr, $noerr);
+}
+
+
my $features_desc = {
mount => {
optional => 1,
ostype => {
optional => 1,
type => 'string',
- enum => [qw(debian ubuntu centos fedora opensuse archlinux alpine gentoo unmanaged)],
+ enum => [qw(debian devuan ubuntu centos fedora opensuse 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 => {
description => {
optional => 1,
type => 'string',
- description => "Container description. Only used on the configuration web interface.",
+ description => "Description for the Container. Shown in the web-interface CT's summary."
+ ." This is saved as comment inside the configuration file.",
+ maxLength => 1024 * 8,
},
searchdomain => {
optional => 1,
},
nameserver => {
optional => 1,
- type => 'string', format => 'address-list',
+ type => 'string', format => 'lxc-ip-with-ll-iface-list',
description => "Sets DNS server IP address for a container. Create will automatically use the setting from the host if you neither set searchdomain nor nameserver.",
},
timezone => {
$confdesc->{"mp$i"} = {
optional => 1,
type => 'string', format => $mp_desc,
- description => "Use volume as container mount point.",
+ description => "Use volume as container mount point. Use the special " .
+ "syntax STORAGE_ID:SIZE_IN_GiB to allocate a new volume.",
optional => 1,
};
}
} else {
warn "vm $vmid - property 'delete' is only allowed in [pve:pending]\n";
}
- } elsif ($line =~ m/^([a-z][a-z_]*\d*):\s*(\S.*)\s*$/) {
+ } elsif ($line =~ m/^([a-z][a-z_]*\d*):\s*(.+?)\s*$/) {
my $key = $1;
my $value = $2;
eval { $value = PVE::LXC::Config->check_type($key, $value); };
return $parse_ct_mountpoint_full->($class, $unused_desc, $volume_string, $noerr);
}
- die "parse_volume - unknown type: $key\n";
+ die "parse_volume - unknown type: $key\n" if !$noerr;
+
+ return;
}
sub print_volume {
} elsif ($opt eq 'swap') {
$hotplug_memory->(undef, 0);
} elsif ($opt eq 'cpulimit') {
- $cgroup->change_cpu_quota(-1, 100000);
+ $cgroup->change_cpu_quota(undef, undef); # reset, cgroup module can better decide values
} elsif ($opt eq 'cpuunits') {
$cgroup->change_cpu_shares(undef, $confdesc->{cpuunits}->{default});
} elsif ($opt =~ m/^net(\d)$/) {
return $reverse ? reverse @names : @names;
}
+sub valid_volume_keys_with_unused {
+ my ($class, $reverse) = @_;
+ my @names = $class->valid_volume_keys();
+ for (my $i = 0; $i < $MAX_UNUSED_DISKS; $i++) {
+ push @names, "unused$i";
+ }
+ return $reverse ? reverse @names : @names;
+}
+
sub get_vm_volumes {
my ($class, $conf, $excludes) = @_;