[lxc-devel] [lxc/lxc] 016029: start: remove procfs pidfd support

2020-03-02 Thread Fabrice Fontaine
  Branch: refs/heads/stable-3.0
  Home:   https://github.com/lxc/lxc
  Commit: 016029499d82166df89189c29fad5dbaa12fe8e9
  https://github.com/lxc/lxc/commit/016029499d82166df89189c29fad5dbaa12fe8e9
  Author: Christian Brauner 
  Date:   2020-01-22 (Wed, 22 Jan 2020)

  Changed paths:
M src/lxc/start.c
M src/lxc/start.h

  Log Message:
  ---
  start: remove procfs pidfd support

We'll only rely on proper anon-inode based pidfd support in the future.
There's no good reason to use the procfs fallback. All the fancy features we
might want to use are only available with anon-inode pidfds.

Signed-off-by: Christian Brauner 


  Commit: 6cd33a153c41618b8cf51e8b7d3a5fa7e61612e8
  https://github.com/lxc/lxc/commit/6cd33a153c41618b8cf51e8b7d3a5fa7e61612e8
  Author: Christian Brauner 
  Date:   2020-01-22 (Wed, 22 Jan 2020)

  Changed paths:
M src/lxc/mainloop.c

  Log Message:
  ---
  mainloop: add missing \n

Signed-off-by: Christian Brauner 


  Commit: b4b6291c7fc3602b10a05d541d80bb00d2e138bf
  https://github.com/lxc/lxc/commit/b4b6291c7fc3602b10a05d541d80bb00d2e138bf
  Author: Christian Brauner 
  Date:   2020-01-22 (Wed, 22 Jan 2020)

  Changed paths:
M src/tests/api_reboot.c

  Log Message:
  ---
  tests: timeout after 60 seconds

That should be more than enough to reboot.

Signed-off-by: Christian Brauner 


  Commit: 83aa9509f0a8db6739aa13e9be2652b4092842c2
  https://github.com/lxc/lxc/commit/83aa9509f0a8db6739aa13e9be2652b4092842c2
  Author: Christian Brauner 
  Date:   2020-01-22 (Wed, 22 Jan 2020)

  Changed paths:
M src/lxc/start.c

  Log Message:
  ---
  start: handle kernel header and kernel incompatability

We might e.g. be compiled in a container with old kernel headers. In this
scenario CLONE_PIDFD will work but pidfd_send_signal() might not be detected
because __NR_pidfd_send_signal is not defined because the kernel headers don't
match the kernel version.

This explains and fixes test-suite hangs on Jenkins I've recently debugged.

Signed-off-by: Christian Brauner 


  Commit: 096bf70cee191e41ea22ee72e81b8aca97bb456b
  https://github.com/lxc/lxc/commit/096bf70cee191e41ea22ee72e81b8aca97bb456b
  Author: Christian Brauner 
  Date:   2020-03-02 (Mon, 02 Mar 2020)

  Changed paths:
M src/lxc/network.c

  Log Message:
  ---
  network: fix typ and formatting in comment

Signed-off-by: Christian Brauner 


  Commit: 061cd51d98ec806f0cc98b64d5606aad642a228a
  https://github.com/lxc/lxc/commit/061cd51d98ec806f0cc98b64d5606aad642a228a
  Author: Christian Brauner 
  Date:   2020-03-02 (Mon, 02 Mar 2020)

  Changed paths:
M src/tests/api_reboot.c

  Log Message:
  ---
  tests: log api reboot test failures

Signed-off-by: Christian Brauner 


  Commit: 7a28653a4ca2c3000d49ffc171c97c9daca186e9
  https://github.com/lxc/lxc/commit/7a28653a4ca2c3000d49ffc171c97c9daca186e9
  Author: Christian Brauner 
  Date:   2020-03-02 (Mon, 02 Mar 2020)

  Changed paths:
M src/lxc/network.c

  Log Message:
  ---
  network: fix network device removal

We can't delete by netdev->ifindex since that's the ifindex of the device in
the container, not on the host. The correct thing is done below.

Signed-off-by: Christian Brauner 


  Commit: 9db43281d0d929d10e52924b7b4d62860e3a91db
  https://github.com/lxc/lxc/commit/9db43281d0d929d10e52924b7b4d62860e3a91db
  Author: LiFeng 
  Date:   2020-03-02 (Mon, 02 Mar 2020)

  Changed paths:
M src/lxc/cgroups/cgroup.c

  Log Message:
  ---
  cgroup.c: fix memory leak at cgroup init failed

Signed-off-by: LiFeng 


  Commit: 3de45bf62d40935afca59c573a7c2a103ee04042
  https://github.com/lxc/lxc/commit/3de45bf62d40935afca59c573a7c2a103ee04042
  Author: Christian Brauner 
  Date:   2020-03-02 (Mon, 02 Mar 2020)

  Changed paths:
M src/tests/api_reboot.c

  Log Message:
  ---
  test: increase timeout for api reboot tests

Signed-off-by: Christian Brauner 


  Commit: 183bda09237f4923c91ec3a567b1cfe2c77f6dea
  https://github.com/lxc/lxc/commit/183bda09237f4923c91ec3a567b1cfe2c77f6dea
  Author: Christian Brauner 
  Date:   2020-03-02 (Mon, 02 Mar 2020)

  Changed paths:
M src/lxc/start.c

  Log Message:
  ---
  start: fix container killing logic

We need to account for the case where pidfd's are not supported by the kernel
in question.

Closes: #3254
Signed-off-by: Christian Brauner 


  Commit: 834e11b633a98ccf30dc87e9c0fa207087a6b4c6
  https://github.com/lxc/lxc/commit/834e11b633a98ccf30dc87e9c0fa207087a6b4c6
  Author: Kirill Petrov 
  Date:   2020-03-02 (Mon, 02 Mar 2020)

  Changed paths:
M configure.ac

  Log Message:
  ---
  cgroups: fix default cgroup pattern

Signed-off-by: Kirill Petrov 


  Commit: f50520d5bc3c603377002e01678bbd12c5d00397
  https://github.com/lxc/lxc/commit/f50520d5bc3c603377002e01678bbd12c5d00397
  Author: Maximilian Blenk 
  Date:   2020-03-02 (Mon, 02 Mar 2020)

  Changed paths:
M src/lxc

[lxc-devel] [lxd/master] Fix typo

2020-03-02 Thread adrian5 on Github
The following pull request was submitted through Github.
It can be accessed and reviewed at: https://github.com/lxc/lxd/pull/6962

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) ===

From 317c5d99407d472d66f16dd778cacccac00e9db4 Mon Sep 17 00:00:00 2001
From: adrian5 
Date: Mon, 2 Mar 2020 13:44:45 +0100
Subject: [PATCH] Fix typo

---
 doc/instances.md | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/doc/instances.md b/doc/instances.md
index 8e2828da1a..4b6faa04ab 100644
--- a/doc/instances.md
+++ b/doc/instances.md
@@ -180,7 +180,7 @@ LXD will always provide the instance with the basic devices 
which are required
 for a standard POSIX system to work. These aren't visible in instance or
 profile configuration and may not be overridden.
 
-Those includes:
+Those include:
 
  - `/dev/null` (character device)
  - `/dev/zero` (character device)
___
lxc-devel mailing list
lxc-devel@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-devel


[lxc-devel] [lxd/master] Implement template files for VMs

2020-03-02 Thread stgraber on Github
The following pull request was submitted through Github.
It can be accessed and reviewed at: https://github.com/lxc/lxd/pull/6963

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) ===

From db0da736dd3737f2d2071263857248edd02a4ac1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= 
Date: Sun, 1 Mar 2020 15:16:39 +0100
Subject: [PATCH 1/2] lxd/vm: Generate the template files
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Stéphane Graber 
---
 lxd/instance/drivers/driver_qemu.go | 146 
 1 file changed, 146 insertions(+)

diff --git a/lxd/instance/drivers/driver_qemu.go 
b/lxd/instance/drivers/driver_qemu.go
index a8f0e41006..4c9e633c70 100644
--- a/lxd/instance/drivers/driver_qemu.go
+++ b/lxd/instance/drivers/driver_qemu.go
@@ -17,10 +17,12 @@ import (
"text/template"
"time"
 
+   "github.com/flosch/pongo2"
"github.com/gorilla/websocket"
"github.com/pborman/uuid"
"github.com/pkg/errors"
"golang.org/x/sys/unix"
+   "gopkg.in/yaml.v2"
 
lxdClient "github.com/lxc/lxd/client"
"github.com/lxc/lxd/lxd/backup"
@@ -41,6 +43,7 @@ import (
"github.com/lxc/lxd/lxd/state"
storagePools "github.com/lxc/lxd/lxd/storage"
storageDrivers "github.com/lxc/lxd/lxd/storage/drivers"
+   pongoTemplate "github.com/lxc/lxd/lxd/template"
"github.com/lxc/lxd/lxd/util"
"github.com/lxc/lxd/lxd/vsock"
"github.com/lxc/lxd/shared"
@@ -1267,6 +1270,144 @@ echo "To start it now, unmount this filesystem and run: 
systemctl start lxd-agen
return err
}
 
+   // Templated files.
+   err = os.MkdirAll(filepath.Join(configDrivePath, "files"), 0500)
+   if err != nil {
+   return err
+   }
+
+   // Template anything that needs templating.
+   key := "volatile.apply_template"
+   if vm.localConfig[key] != "" {
+   // Run any template that needs running.
+   err = vm.templateApplyNow(vm.localConfig[key], 
filepath.Join(configDrivePath, "files"))
+   if err != nil {
+   return err
+   }
+
+   // Remove the volatile key from the DB.
+   err := vm.state.Cluster.ContainerConfigRemove(vm.id, key)
+   if err != nil {
+   return err
+   }
+   }
+
+   err = vm.templateApplyNow("start", filepath.Join(configDrivePath, 
"files"))
+   if err != nil {
+   return err
+   }
+
+   // Copy the template metadata itself too.
+   metaPath := filepath.Join(vm.Path(), "metadata.yaml")
+   if shared.PathExists(metaPath) {
+   err = shared.FileCopy(metaPath, filepath.Join(configDrivePath, 
"files/metadata.yaml"))
+   if err != nil {
+   return err
+   }
+   }
+
+   return nil
+}
+
+func (vm *qemu) templateApplyNow(trigger string, path string) error {
+   // If there's no metadata, just return.
+   fname := filepath.Join(vm.Path(), "metadata.yaml")
+   if !shared.PathExists(fname) {
+   return nil
+   }
+
+   // Parse the metadata.
+   content, err := ioutil.ReadFile(fname)
+   if err != nil {
+   return errors.Wrap(err, "Failed to read metadata")
+   }
+
+   metadata := new(api.ImageMetadata)
+   err = yaml.Unmarshal(content, &metadata)
+   if err != nil {
+   return errors.Wrapf(err, "Could not parse %s", fname)
+   }
+
+   // Figure out the instance architecture.
+   arch, err := osarch.ArchitectureName(vm.architecture)
+   if err != nil {
+   arch, err = 
osarch.ArchitectureName(vm.state.OS.Architectures[0])
+   if err != nil {
+   return errors.Wrap(err, "Failed to detect system 
architecture")
+   }
+   }
+
+   // Generate the container metadata
+   instanceMeta := make(map[string]string)
+   instanceMeta["name"] = vm.name
+   instanceMeta["architecture"] = arch
+
+   if vm.ephemeral {
+   instanceMeta["ephemeral"] = "true"
+   } else {
+   instanceMeta["ephemeral"] = "false"
+   }
+
+   // Go through the templates
+   for tplPath, tpl := range metadata.Templates {
+   var w *os.File
+
+   // Check if the template should be applied now
+   found := false
+   for _, tplTrigger := range tpl.When {
+   if tplTrigger == trigger {
+   found = true
+   break
+   }
+   }
+
+   if !found {
+   continue
+   }
+
+   // Create

[lxc-devel] [lxd/master] doc: Typo and formatting improvements

2020-03-02 Thread tomponline on Github
The following pull request was submitted through Github.
It can be accessed and reviewed at: https://github.com/lxc/lxd/pull/6966

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: Thomas Parrott 
From 19ba4d2f5009cf632bcf5cafcb487465af2890d9 Mon Sep 17 00:00:00 2001
From: Thomas Parrott 
Date: Mon, 2 Mar 2020 15:59:37 +
Subject: [PATCH] doc: Typo and formatting improvements

Signed-off-by: Thomas Parrott 
---
 doc/instances.md | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/doc/instances.md b/doc/instances.md
index 8e2828da1a..15f572b773 100644
--- a/doc/instances.md
+++ b/doc/instances.md
@@ -180,7 +180,7 @@ LXD will always provide the instance with the basic devices 
which are required
 for a standard POSIX system to work. These aren't visible in instance or
 profile configuration and may not be overridden.
 
-Those includes:
+Those include:
 
  - `/dev/null` (character device)
  - `/dev/zero` (character device)
@@ -571,6 +571,7 @@ either be a bind-mount of an existing file or directory on 
the host, or
 if the source is a block device, a regular mount.
 
 LXD supports the following additional source types:
+
 - Ceph-rbd: Mount from existing ceph RBD device that is externally managed. 
LXD can use ceph to manage an internal file system for the instance, but in the 
event that a user has a previously existing ceph RBD that they would like use 
for this instance, they can use this command.
 Example command
 ```
___
lxc-devel mailing list
lxc-devel@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-devel


[lxc-devel] [lxc-ci/master] Add Fedora VM support

2020-03-02 Thread monstermunchkin on Github
The following pull request was submitted through Github.
It can be accessed and reviewed at: https://github.com/lxc/lxc-ci/pull/115

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) ===

From 5b26324d5cb49c01c722ce7ab528b10e2902bcf8 Mon Sep 17 00:00:00 2001
From: Thomas Hipp 
Date: Thu, 20 Feb 2020 10:53:52 +0100
Subject: [PATCH 1/2] images: Add Fedora VM support

Signed-off-by: Thomas Hipp 
---
 images/fedora.yaml | 76 ++
 1 file changed, 76 insertions(+)

diff --git a/images/fedora.yaml b/images/fedora.yaml
index 68056c1..7f31db5 100644
--- a/images/fedora.yaml
+++ b/images/fedora.yaml
@@ -36,6 +36,42 @@ targets:
   lxc.arch = {{ image.architecture_kernel }}
 
 files:
+  - path: /etc/default/grub
+generator: dump
+content: |-
+  # Set the recordfail timeout
+  GRUB_RECORDFAIL_TIMEOUT=0
+
+  # Do not wait on grub prompt
+  GRUB_TIMEOUT=0
+
+  # Set the default commandline
+  GRUB_CMDLINE_LINUX_DEFAULT="console=tty1 console=ttyS0"
+
+  # Set the grub console type
+  GRUB_TERMINAL=console
+
+  # Disable os-prober
+  GRUB_DISABLE_OS_PROBER=true
+types:
+  - vm
+
+  - path: /etc/dracut.conf.d/lxd.conf
+generator: dump
+content: |-
+  add_drivers+=virtio_scsi
+types:
+  - vm
+
+  - generator: fstab
+types:
+  - vm
+
+  - path: /etc/machine-id
+generator: dump
+types:
+  - vm
+
   - path: /etc/hostname
 generator: hostname
 
@@ -94,6 +130,10 @@ files:
 variants:
   - cloud
 
+  - generator: lxd-agent
+types:
+ - vm
+
 packages:
   manager: dnf
   update: true
@@ -140,6 +180,16 @@ packages:
   - sssd-client
  action: remove
 
+   - packages:
+ - grub2-efi-x64
+ - kernel
+ - shim
+ - btrfs-progs
+ - dracut
+ action: install
+ types:
+   - vm
+
 actions:
   - trigger: post-packages
 action: |-
@@ -167,3 +217,29 @@ actions:
   systemctl enable cloud-final
 variants:
   - cloud
+
+  - trigger: post-unpack
+action: |-
+  # Generate machine-id in order for the kernel stuff to be configured 
properly
+  systemd-machine-id-setup
+
+  - trigger: post-files
+action: |-
+  #!/bin/sh
+  set -eux
+
+  grub2-mkconfig -o $(readlink -f /etc/grub2-efi.cfg)
+
+  # Regenerate initramfs
+  kver=$(ls /boot/initramfs-*.img | sed -r 's#.*initramfs-(.+)\.img#\1#')
+  dracut --kver "${kver}" -f
+
+  # Unmask all masked unit files
+  for f in $(find /etc/systemd/system -type l); do
+[[ "$(readlink ${f})" == /dev/null ]] && rm "${f}"
+  done
+
+  # Remove the "Container Image" string as this is going to be am VM
+  sed -i 's/[ ]*(Container Image)//;/^VARIANT/d' /etc/os-release
+types:
+  - vm

From 4e8fd18b4200d001eee16e232622a8dc2b60dbee Mon Sep 17 00:00:00 2001
From: Thomas Hipp 
Date: Mon, 2 Mar 2020 17:26:08 +0100
Subject: [PATCH 2/2] jenkins/jobs: Add Fedora VM support

Signed-off-by: Thomas Hipp 
---
 jenkins/jobs/image-fedora.yaml | 9 +++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/jenkins/jobs/image-fedora.yaml b/jenkins/jobs/image-fedora.yaml
index bed18f0..715d6fa 100644
--- a/jenkins/jobs/image-fedora.yaml
+++ b/jenkins/jobs/image-fedora.yaml
@@ -45,8 +45,13 @@
 [ "${ARCH}" = "armhf" ] && ARCH="armhfp"
 [ "${ARCH}" = "ppc64el" ] && ARCH="ppc64le"
 
+TYPE="container"
+if [ "${architecture}" = "amd64" ] || [ "${architecture}" = "arm64" ]; 
then
+TYPE="container,vm"
+fi
+
 exec sudo /lxc-ci/bin/build-distro /lxc-ci/images/fedora.yaml \
-${LXD_ARCHITECTURE} container 1800 ${WORKSPACE} \
+${LXD_ARCHITECTURE} ${TYPE} 1800 ${WORKSPACE} \
 -o image.architecture=${ARCH} -o image.release=${release} \
 -o image.variant=${variant}
 
@@ -59,7 +64,7 @@
 
 publishers:
 - archive:
-artifacts: "*.tar.xz,*.squashfs,image.yaml,serial"
+artifacts: "*.qcow2,*.tar.xz,*.squashfs,image.yaml,serial"
 only-if-success: true
 
 - workspace-cleanup:
___
lxc-devel mailing list
lxc-devel@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-devel


[lxc-devel] [lxd/master] add hugetlbfs and hugepages handling for containers

2020-03-02 Thread brauner on Github
The following pull request was submitted through Github.
It can be accessed and reviewed at: https://github.com/lxc/lxd/pull/6967

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 
From bd3292244c2a35fd6ae12c18452aa2c2be96ffe4 Mon Sep 17 00:00:00 2001
From: Christian Brauner 
Date: Mon, 2 Mar 2020 15:27:05 +0100
Subject: [PATCH 1/4] seccomp: handle hugetlbfs mount syscall interception

hugetlbfs already allocates new instances on every mount.
We can deal with the filesystem through existing mount interception.

We just need to add automatic handling of uid and gid mount options when
detecting a hugetlbfs mount. We also need to have hugetlbfs bypass the shifted
option as we don't want to put shiftfs on top of it when we already set the
correct uid/gid.

Signed-off-by: Christian Brauner 
---
 lxd/seccomp/seccomp.go | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/lxd/seccomp/seccomp.go b/lxd/seccomp/seccomp.go
index f996bb19d9..97b11c6c14 100644
--- a/lxd/seccomp/seccomp.go
+++ b/lxd/seccomp/seccomp.go
@@ -1249,6 +1249,15 @@ func mountFlagsToOpts(flags C.ulong) string {
return opts
 }
 
+// mountHandleHugetlbfsArgs adds user namespace root uid and gid to the
+// hugetlbfs mount options to make it useable in unprivileged containers.
+func (s *Server) mountHandleHugetlbfsArgs(args *MountArgs, nsuid int64, nsgid 
int64) {
+   if args.fstype == "hugetlbfs" && args.data == "" {
+   args.data = fmt.Sprintf("uid=%d,gid=%d", nsuid, nsgid)
+   args.shift = false
+   }
+}
+
 // HandleMountSyscall handles mount syscalls.
 func (s *Server) HandleMountSyscall(c Instance, siov *Iovec) int {
ctx := log.Ctx{"container": c.Name(),
@@ -1339,6 +1348,8 @@ func (s *Server) HandleMountSyscall(c Instance, siov 
*Iovec) int {
return 0
}
 
+   s.mountHandleHugetlbfsArgs(&args, nsuid, nsgid)
+
if fuseBinary != "" {
// Record ignored flags for debugging purposes
flags := C.ulong(args.flags)

From 8174951d490bcbcec07211f7e7728e86a233ab24 Mon Sep 17 00:00:00 2001
From: Christian Brauner 
Date: Mon, 2 Mar 2020 17:34:28 +0100
Subject: [PATCH 2/4] doc: add container_syscall_intercept_hugetlbfs

Signed-off-by: Christian Brauner 
---
 doc/api-extensions.md | 6 ++
 shared/version/api.go | 1 +
 2 files changed, 7 insertions(+)

diff --git a/doc/api-extensions.md b/doc/api-extensions.md
index 5d9fd59a8a..2bedc3a5ab 100644
--- a/doc/api-extensions.md
+++ b/doc/api-extensions.md
@@ -926,3 +926,9 @@ Introduces the ability to create a storage pool from an 
existing non-empty volum
 This option should be used with care, as LXD can then not guarantee that 
volume name conflicts won't occur
 with non-LXD created volumes in the same volume group.
 This could also potentially lead to LXD deleting a non-LXD volume should name 
conflicts occur.
+
+## container\_syscall\_intercept\_hugetlbfs
+When mount syscall interception is enabled and hugetlbfs is specified as an
+allowed filesystem type LXD will mount a separate hugetlbfs instance for the
+container with the uid and gid mount options set to the container's root uid
+and gid. This ensure that processes in the container can use hugepages.
diff --git a/shared/version/api.go b/shared/version/api.go
index 503c7d4138..fbc50b997c 100644
--- a/shared/version/api.go
+++ b/shared/version/api.go
@@ -190,6 +190,7 @@ var APIExtensions = []string{
"clustering_sizing",
"firewall_driver",
"projects_limits",
+   "container_syscall_intercept_hugetlbfs",
 }
 
 // APIExtensionsCount returns the number of available API extensions.

From 81615cd980672594c564d5b6c9baa542650f2786 Mon Sep 17 00:00:00 2001
From: Christian Brauner 
Date: Mon, 2 Mar 2020 17:10:18 +0100
Subject: [PATCH 3/4] limits: add limits.hugepages.* keys

limits.hugepages.64KB
limits.hugepages.1MB
limits.hugepages.2MB
limits.hugepages.1GB

Signed-off-by: Christian Brauner 
---
 lxd/cgroup/abstraction.go  | 18 ++
 lxd/cgroup/init.go | 10 ++
 lxd/instance/drivers/driver_lxc.go | 26 ++
 shared/instance.go |  5 +
 4 files changed, 59 insertions(+)

diff --git a/lxd/cgroup/abstraction.go b/lxd/cgroup/abstraction.go
index ab8a910cf5..61b7ccf664 100644
--- a/lxd/cgroup/abstraction.go
+++ b/lxd/cgroup/abstraction.go
@@ -305,3 +305,21 @@ func (cg *CGroup) SetNetIfPrio(value string) error {
}
return ErrUnknownVersion
 }
+
+// SetMaxHugepages applies a limit to the number of processes
+func (cg *CGroup) SetMaxHugepages(pageType string, value string) error {
+   // Confirm we have the controller
+   version := cgControllers["hugetlb"]
+   switch version {
+   case Unavailable:
+   return ErrControllerMissing
+   case V1:

[lxc-devel] [distrobuilder/master] main: Fix build-lxd for VMs

2020-03-02 Thread monstermunchkin on Github
The following pull request was submitted through Github.
It can be accessed and reviewed at: https://github.com/lxc/distrobuilder/pull/293

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) ===
This fixes an issue where the --vm flag would be ignored if running
build-lxd.

Signed-off-by: Thomas Hipp 
From ef2260f5cfb0ac09a263633d896d3776f2113c87 Mon Sep 17 00:00:00 2001
From: Thomas Hipp 
Date: Mon, 2 Mar 2020 18:21:59 +0100
Subject: [PATCH] main: Fix build-lxd for VMs

This fixes an issue where the --vm flag would be ignored if running
build-lxd.

Signed-off-by: Thomas Hipp 
---
 distrobuilder/main.go | 1 +
 distrobuilder/main_lxd.go | 4 
 2 files changed, 1 insertion(+), 4 deletions(-)

diff --git a/distrobuilder/main.go b/distrobuilder/main.go
index 2d4c542..6fba06a 100644
--- a/distrobuilder/main.go
+++ b/distrobuilder/main.go
@@ -275,6 +275,7 @@ func (c *cmdGlobal) preRunBuild(cmd *cobra.Command, args 
[]string) error {
 
if ok {
imageTargets |= shared.ImageTargetVM
+   c.definition.Targets.Type = "vm"
} else {
imageTargets |= shared.ImageTargetContainer
}
diff --git a/distrobuilder/main_lxd.go b/distrobuilder/main_lxd.go
index b2f51c4..2fa2648 100644
--- a/distrobuilder/main_lxd.go
+++ b/distrobuilder/main_lxd.go
@@ -53,10 +53,6 @@ func (c *cmdLXD) commandBuild() *cobra.Command {
}
defer cleanup()
 
-   if c.flagVM {
-   c.global.definition.Targets.Type = "vm"
-   }
-
return c.run(cmd, args, overlayDir)
},
}
___
lxc-devel mailing list
lxc-devel@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-devel