The following pull request was submitted through Github. It can be accessed and reviewed at: https://github.com/lxc/lxd/pull/3182
This e-mail was sent by the LXC bot, direct replies will not reach the author unless they happen to be subscribed to this list. === Description (from pull-request) === Signed-off-by: Christian Brauner <[email protected]>
From 96db9f1489fc9e40ca4f77348874e881b5101d6c Mon Sep 17 00:00:00 2001 From: Christian Brauner <[email protected]> Date: Mon, 17 Apr 2017 21:13:04 +0200 Subject: [PATCH 1/2] lxd init: allow to create subvolume for btrfs pool Signed-off-by: Christian Brauner <[email protected]> --- lxd/main_init.go | 38 +++++++++++++++++++++++--------------- 1 file changed, 23 insertions(+), 15 deletions(-) diff --git a/lxd/main_init.go b/lxd/main_init.go index 519f09b..72fedd9 100644 --- a/lxd/main_init.go +++ b/lxd/main_init.go @@ -334,23 +334,31 @@ func cmdInit() error { } storageDevice = askString("Path to the existing block device: ", "", deviceExists) } else { - st := syscall.Statfs_t{} - err := syscall.Statfs(shared.VarPath(), &st) - if err != nil { - return fmt.Errorf("couldn't statfs %s: %s", shared.VarPath(), err) - } + backingFs, err := filesystemDetect(shared.VarPath()) + if err == nil && storageBackend == "btrfs" && backingFs == "btrfs" { + if askBool("Would you like to create a new subvolume for the BTRFS storage pool (yes/no) [default=yes]: ", "yes") { + storageDataset = shared.VarPath("storage-pools", storagePool) + } + } else { - /* choose 15 GB < x < 100GB, where x is 20% of the disk size */ - def := uint64(st.Frsize) * st.Blocks / (1024 * 1024 * 1024) / 5 - if def > 100 { - def = 100 - } - if def < 15 { - def = 15 - } + st := syscall.Statfs_t{} + err := syscall.Statfs(shared.VarPath(), &st) + if err != nil { + return fmt.Errorf("couldn't statfs %s: %s", shared.VarPath(), err) + } - q := fmt.Sprintf("Size in GB of the new loop device (1GB minimum) [default=%dGB]: ", def) - storageLoopSize = askInt(q, 1, -1, fmt.Sprintf("%d", def)) + /* choose 15 GB < x < 100GB, where x is 20% of the disk size */ + def := uint64(st.Frsize) * st.Blocks / (1024 * 1024 * 1024) / 5 + if def > 100 { + def = 100 + } + if def < 15 { + def = 15 + } + + q := fmt.Sprintf("Size in GB of the new loop device (1GB minimum) [default=%dGB]: ", def) + storageLoopSize = askInt(q, 1, -1, fmt.Sprintf("%d", def)) + } } } else { q := fmt.Sprintf("Name of the existing %s pool or dataset: ", strings.ToUpper(storageBackend)) From 71127bd583a245b048973ad637b7bb5fcca4e405 Mon Sep 17 00:00:00 2001 From: Christian Brauner <[email protected]> Date: Mon, 17 Apr 2017 21:17:20 +0200 Subject: [PATCH 2/2] lxd init: add all storage options Signed-off-by: Christian Brauner <[email protected]> --- lxd/main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lxd/main.go b/lxd/main.go index 3258f3d..6901813 100644 --- a/lxd/main.go +++ b/lxd/main.go @@ -115,7 +115,7 @@ func run() error { fmt.Printf(" --network-port PORT\n") fmt.Printf(" Port to bind LXD to (default: 8443)\n") fmt.Printf(" --storage-backend NAME\n") - fmt.Printf(" Storage backend to use (zfs or dir, default: dir)\n") + fmt.Printf(" Storage backend to use (btrfs, dir, lvm or zfs, default: dir)\n") fmt.Printf(" --storage-create-device DEVICE\n") fmt.Printf(" Setup device based storage using DEVICE\n") fmt.Printf(" --storage-create-loop SIZE\n")
_______________________________________________ lxc-devel mailing list [email protected] http://lists.linuxcontainers.org/listinfo/lxc-devel
