]> git.proxmox.com Git - pve-container.git/commitdiff
add rbd storage type support
authorAlexandre Derumier <aderumier@odiso.com>
Wed, 12 Aug 2015 09:08:02 +0000 (11:08 +0200)
committerDietmar Maurer <dietmar@proxmox.com>
Wed, 12 Aug 2015 10:26:17 +0000 (12:26 +0200)
Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
src/PVE/API2/LXC.pm
src/PVE/LXC.pm
src/PVE/LXCCreate.pm

index 481929501440e7f9d3edf01bed80369785dc93ee..7a65402003d856735df0cb5f4d97570f8d05924b 100644 (file)
@@ -72,7 +72,12 @@ my $alloc_rootfs = sub {
        } elsif ($scfg->{type} eq 'drbd') {
 
            $volid = PVE::Storage::vdisk_alloc($storage_conf, $storage, $vmid, 'raw', undef, $size);
-           
+
+       } elsif ($scfg->{type} eq 'rbd') {
+
+           die "krbd option must be enabled on storage type '$scfg->{type}'\n" if !$scfg->{krbd};
+           $volid = PVE::Storage::vdisk_alloc($storage_conf, $storage, $vmid, 'raw', undef, $size);
+
        } else {
            die "unable to create containers on storage type '$scfg->{type}'\n";
        }
index dadaaf73be3b5e04d9b6699b00567f56bc4500f9..a1a5197a03013e23b6773f1f6502d2e8bb416f49 100644 (file)
@@ -943,7 +943,7 @@ sub update_lxc_config {
     } elsif ($scfg->{type} eq 'zfspool') {
        my $rootfs = PVE::Storage::path($storage_cfg, $volid);
        $raw .= "lxc.rootfs = $rootfs\n";
-    } elsif ($scfg->{type} eq 'drbd') {
+    } elsif ($scfg->{type} eq 'drbd' || $scfg->{type} eq 'rbd') {
        my $rootdev = PVE::Storage::path($storage_cfg, $volid);
        $raw .= "lxc.rootfs = $rootdev\n";
     } else {
index 8847edcbde9b1c6ea0c7e6b9e5c6a075aba63c30..4e742c098bdd30c572a4490e817568b3af9b6549 100644 (file)
@@ -289,13 +289,16 @@ sub create_rootfs {
        create_rootfs_subvol($storage_cfg, $storage, $volid, $vmid, $conf, $archive, $password, $restore);
     } elsif ($format eq 'raw') {
        my $scfg = PVE::Storage::storage_config($storage_cfg, $storage);
+       PVE::Storage::activate_storage($storage_cfg, $storage);
+       PVE::Storage::activate_volumes($storage_cfg, [$volid]);
        if ($scfg->{path}) {
            create_rootfs_dir_loop($storage_cfg, $storage, $volid, $vmid, $conf, $archive, $password, $restore);
-       } elsif ($scfg->{type} eq 'drbd') {
+       } elsif ($scfg->{type} eq 'drbd' || $scfg->{type} eq 'rbd') {
            create_rootfs_dev($storage_cfg, $storage, $volid, $vmid, $conf, $archive, $password, $restore);
        } else {
            die "unable to create containers on storage type '$scfg->{type}'\n";
        }
+       PVE::Storage::deactivate_volumes($storage_cfg, [$volid]);
     } else {
        die "unsupported image format '$format'\n";
     }