]> git.proxmox.com Git - pve-container.git/commitdiff
fix #1147: allow marking non-volume mps as shared
authorFabian Grünbichler <f.gruenbichler@proxmox.com>
Fri, 14 Oct 2016 10:51:03 +0000 (12:51 +0200)
committerDietmar Maurer <dietmar@proxmox.com>
Thu, 3 Nov 2016 09:50:20 +0000 (10:50 +0100)
this introduces a new option for non-volume mount points,
modeled after the way we define 'shared' storages: the
boolean flag 'shared' marks a mount point as available on
other nodes (default: false)

when migrating containers with non-volume mount points,
this new property is checked, and a migration is only
allowed if all such mount points are 'shared'.

setting this flag allows containers with non-volume mount
points to be migrated by the ha-manager as well, which was
previously not possible.

for backwards compatibility, the old "workaround" option
'-force' for 'pct migrate' still works, but displays a
warning pointing to the new options.

src/PVE/API2/LXC.pm
src/PVE/LXC/Config.pm
src/PVE/LXC/Migrate.pm

index 15ebb87f9e336b0274ad559ff97f3b790cf87b29..d0e558a41d02cbdffa06c843f0f2cd1490a63fcb 100644 (file)
@@ -848,8 +848,7 @@ __PACKAGE__->register_method({
            force => {
                type => 'boolean',
                description => "Force migration despite local bind / device" .
-                   " mounts. WARNING: identical bind / device mounts need to ".
-                   " be available on the target node.",
+                   " mounts. NOTE: deprecated, use 'shared' property of mount point instead.",
                optional => 1,
            },
        },
index 608653ded0cb61b3f8e7f2daf6673894152ee586..0ef03dcea7677afe9cf1f6c2ad8cb62a8731c2df 100644 (file)
@@ -245,6 +245,13 @@ my $rootfs_desc = {
        description => 'Enable user quotas inside the container (not supported with zfs subvolumes)',
        optional => 1,
     },
+    shared => {
+       type => 'boolean',
+       description => 'Mark this non-volume mount point as available on multiple nodes (see \'nodes\')',
+       verbose_description => "Mark this non-volume mount point as available on all nodes.\n\nWARNING: This option does not share the mount point automatically, it assumes it is shared already!",
+       optional => 1,
+       default => 0,
+    },
 };
 
 PVE::JSONSchema::register_standard_option('pve-ct-rootfs', {
index 1c168bbf81ad1b183f75af1094d803d29eed48f2..10b2b691da5dca307277a1c8e0ae83243a2fbfe6 100644 (file)
@@ -46,11 +46,21 @@ sub prepare {
        my ($ms, $mountpoint) = @_;
 
        my $volid = $mountpoint->{volume};
+       my $type = $mountpoint->{type};
 
-       # skip dev/bind mps when forced
-       if ($mountpoint->{type} ne 'volume' && $force) {
-           return;
+       # skip dev/bind mps when forced / shared
+       if ($type ne 'volume') {
+           if ($force) {
+               warn "-force is deprecated, please use the 'shared' property on individual non-volume mount points instead!\n";
+               return;
+           }
+           if ($mountpoint->{shared}) {
+               return;
+           } else {
+               die "cannot migrate local $type mount point '$ms'\n";
+           }
        }
+
        my ($storage, $volname) = PVE::Storage::parse_volume_id($volid, 1) if $volid;
        die "can't determine assigned storage for mountpoint '$ms'\n" if !$storage;
 
@@ -151,8 +161,7 @@ sub phase1 {
        my $volid = $mountpoint->{volume};
        # already checked in prepare
        if ($mountpoint->{type} ne 'volume') {
-           $self->log('info', "ignoring mountpoint '$ms' ('$volid') of type " .
-               "'$mountpoint->{type}', migration is forced.")
+           $self->log('info', "ignoring shared '$mountpoint->{type}' mount point '$ms' ('$volid')")
                if !$snapname;
            return;
        }