LXD 3.16 リリースのお知らせ¶
9th of August 2019
はじめに ¶
LXD チームは、LXD 3.16 のリリースをお知らせすることにとてもワクワクしています!
このリリースではたくさんの新機能、設定オプション、コマンドラインツールの改良が行われました。
水面下では、インフラの再構築に多くの作業が費やされました。それはコンテナデバイスで使われるもので、nic
、infiniband
、proxy
といったデバイスが新しいロジックに切り替わりました。この結果、これまでよりずっとクリーンなコードになり、デバッグがしやすくなり、テストも改善され、エラーハンドリングと設定のバリデーションもより網羅的になりました。
Enjoy!
新機能 ¶
disk
デバイスの shift
プロパティ ¶
任意の disk
デバイスで LXD に対して shiftfs
オーバーレイを設定するようにリクエストできるようになりました。
これにより、非特権コンテナで所有権を取得するために ACL/chown と言ったトリックに頼ることなく、ホストシステムのディスクやディレクトリをコンテナに提供できます。
stgraber@castiana:~$ lxc config device add c1 home disk path=/home source=/home Device home added to c1 stgraber@castiana:~$ lxc exec c1 -- ls -lh /home total 537K drwxr-xr-x 14 nobody nogroup 18 Mar 13 20:32 blah drwx--x--x 33 nobody nogroup 86 Aug 9 22:25 stgraber stgraber@castiana:~$ lxc config device remove c1 home Device home removed from c1 stgraber@castiana:~$ lxc config device add c1 home disk path=/home source=/home shift=true Device home added to c1 stgraber@castiana:~$ lxc exec c1 -- ls -lh /home total 537K drwxr-xr-x 14 ubuntu ubuntu 18 Mar 13 20:32 blah drwx--x--x 33 201105 200512 86 Aug 9 22:25 stgraber stgraber@castiana:~$
注意: この機能は 5.0 以上の Ubuntu カーネルの `shiftfs` 機能が必要です。snap ユーザーは、snap の設定を通して、この機能を許可しなければいけません。詳しくは [こちら](https://discuss.linuxcontainers.org/t/trying-out-shiftfs/5155) を参照してください。 #### カスタムストレージボリューム向けの `security.shifted` プロパティ 新たに追加された `disk` デバイス用の `shift` ロジックを使い、`shiftfs` を使って、カスタムストレージボリュームをコンテナにアタッチできるようになりました。 これにより、共有カスタムボリュームを特権、非特権、(id マッピングが他と)分離されたコンテナの組み合わせにアタッチできるようになりました。 stgraber@castiana:~$ lxc launch ubuntu:18.04 c1 Creating c1 Starting c1 stgraber@castiana:~$ lxc launch ubuntu:18.04 c2 -c security.privileged=true Creating c2 Starting c2 stgraber@castiana:~$ lxc launch ubuntu:18.04 c3 -c security.idmap.isolated=true Creating c3 Starting c3 stgraber@castiana:~$ lxc storage volume create default demo security.shifted=true Storage volume demo created stgraber@castiana:~$ lxc storage volume attach default demo c1 demo /demo stgraber@castiana:~$ lxc storage volume attach default demo c2 demo /demo stgraber@castiana:~$ lxc storage volume attach default demo c3 demo /demo stgraber@castiana:~$ lxc exec c1 -- touch /demo/blah stgraber@castiana:~$ lxc exec c1 -- chown 123:456 /demo/blah stgraber@castiana:~$ lxc exec c2 -- ls -lh /demo total 512 -rw-r--r-- 1 123 456 0 Aug 9 23:17 blah stgraber@castiana:~$ lxc exec c3 -- ls -lh /demo total 512 -rw-r--r-- 1 123 456 0 Aug 9 23:17 blah stgraber@castiana:~$ 注意: この機能は 5.0 以上の Ubuntu カーネルの `shiftfs` 機能が必要です。snap ユーザーは、snap の設定を通して、この機能を許可しなければいけません。詳しくは [こちら](https://discuss.linuxcontainers.org/t/trying-out-shiftfs/5155) を参照してください。 #### 空のコンテナの作成 これまで、デフォルトのコマンドラインツールを使って新しいコンテナを作成する唯一の方法は、ローカルであれリモートであれ、既存のイメージを使うことでした。 LXD はこれまでも空のコンテナ作成をサポートしてきました。しかし、そのメカニズムは API 経由で直接使えるだけであり、多数のデーターマイグレーションツールが使っていました。 ユーザーからの要求に応じて、`lxc init` コマンドに `--empty` を追加しました。これで空のコンテナが作れるようになりました。このように作ったコンテナは起動できません。コンテナのファイルシステムは、ホストシステム上で直接設定するか、`lxc file` コマンドを通して設定するかのいずれかで、手動で設定する必要があります。 stgraber@castiana:~$ lxc init --empty c1 Creating c1 stgraber@castiana:~$ lxc list c1 +------+---------+------+------+------------+-----------+ | NAME | STATE | IPV4 | IPV6 | TYPE | SNAPSHOTS | +------+---------+------+------+------------+-----------+ | c1 | STOPPED | | | PERSISTENT | 0 | +------+---------+------+------+------------+-----------+ #### システムコールインターセプションの設定 システムコールインターセプションのロジックが拡張され、既存の `mknod` に加えて `setxattr` のサポートが追加されました。同時に、この機能は設定キー配下に移動し、各システムコールは個別に切り替えできるようになりました。 ふたつの新しいオプションは次のものです: - security.syscall.intercept.mknod - security.syscall.intercept.setxattr どちらもデフォルトは `false` に設定されており、この機能を有効にするには 5.0 カーネル、LXC 3.2、libseccomp の最新のスナップショットが必要です。 #### リソース API に `infiniband` データを追加 LXD 3.15 からのリソース API の再作業により、Infiniband デバイスの情報が少し多くレポートされるようになりました。特にそれを動かすのに使うキャラクターデバイスについてレポートするようになりました。 `lxc info --resources` の関連部分は次のようになります: Card 0: NUMA node: 1 Vendor: Mellanox Technologies (15b3) Product: MT27500 Family [ConnectX-3] (1003) PCI address: 0000:82:00.0 Driver: mlx4_core (4.0-0) Ports: - Port 1 (ethernet) ID: enp130s0d1 Address: 00:02:c9:a0:00:91 Supported modes: 1000baseKX/Full, 10000baseKX4/Full, 10000baseKR/Full Supported ports: fibre Port type: fibre Transceiver type: internal Auto negotiation: false Link detected: false - Port 0 (infiniband) ID: ib0 Address: 80:00:0a:80:fe:80:00:00:00:00:00:00:00:02:c9:03:00:a0:00:91 Auto negotiation: false Link detected: false Infiniband: IsSM: issm0 (231:64) MAD: umad0 (231:0) Verb: uverbs0 (231:192) SR-IOV information: Current number of VFs: 4 Maximum number of VFs: 31 VFs: 31 - NUMA node: 1 Vendor: Mellanox Technologies (15b3) Product: MT27500/MT27520 Family [ConnectX-3/ConnectX-3 Pro Virtual Function] (1004) PCI address: 0000:82:00.1 Driver: mlx4_core (4.0-0) Ports: - Port 1 (ethernet) ID: enp130s0f1d1 Address: 5e:93:07:c6:ae:4c Auto negotiation: false Link detected: false - Port 0 (infiniband) ID: ib1 Address: 80:00:0a:81:fe:80:00:00:00:00:00:00:6a:fc:bc:b5:23:4f:ba:c9 Auto negotiation: false Link detected: false Infiniband: IsSM: issm2 (231:66) MAD: umad2 (231:2) Verb: uverbs1 (231:193) - NUMA node: 1 Vendor: Mellanox Technologies (15b3) Product: MT27500/MT27520 Family [ConnectX-3/ConnectX-3 Pro Virtual Function] (1004) PCI address: 0000:82:00.2 Driver: mlx4_core (4.0-0) Ports: - Port 1 (ethernet) ID: enp130s0f2d1 Address: c2:21:28:88:3a:00 Auto negotiation: false Link detected: false - Port 0 (infiniband) ID: ib2 Address: 80:00:0a:82:fe:80:00:00:00:00:00:00:ae:12:68:fa:cd:db:53:f1 Auto negotiation: false Link detected: false Infiniband: IsSM: issm4 (231:68) MAD: umad4 (231:4) Verb: uverbs2 (231:194) - NUMA node: 1 Vendor: Mellanox Technologies (15b3) Product: MT27500/MT27520 Family [ConnectX-3/ConnectX-3 Pro Virtual Function] (1004) PCI address: 0000:82:00.3 Driver: mlx4_core (4.0-0) Ports: - Port 1 (ethernet) ID: enp130s0f3d1 Address: c6:f0:fb:b2:0b:81 Auto negotiation: false Link detected: false - Port 0 (infiniband) ID: ib3 Address: 80:00:0a:83:fe:80:00:00:00:00:00:00:0a:94:39:75:2d:fe:6e:19 Auto negotiation: false Link detected: false Infiniband: IsSM: issm6 (231:70) MAD: umad6 (231:6) Verb: uverbs3 (231:195) - NUMA node: 1 Vendor: Mellanox Technologies (15b3) Product: MT27500/MT27520 Family [ConnectX-3/ConnectX-3 Pro Virtual Function] (1004) PCI address: 0000:82:00.4 Driver: mlx4_core (4.0-0) Ports: - Port 1 (ethernet) ID: enp130s0f4d1 Address: fa:4a:c2:9d:f0:2d Auto negotiation: false Link detected: false - Port 0 (infiniband) ID: ib4 Address: 80:00:0a:84:fe:80:00:00:00:00:00:00:0a:73:ab:6d:2c:c6:62:df Auto negotiation: false Link detected: false Infiniband: IsSM: issm8 (231:72) MAD: umad8 (231:8) Verb: uverbs4 (231:196) GPU の DRM や NVIDIA デバイスノードの情報と同様のレポートになります。 #### クライアントの `set` コマンドの変更 コマンドラインツールでより一貫性を持たせるため、`set` コマンドはすべて複数の `key=value` オプションを受け付けるようになりました。これにより、`edit` コマンドを使ったり、インタラクティブなテキストエディタを使うことなしに、同時に複数のキーの値を変更する必要がある設定をより簡単に行えるようになりました。 新しい形式も古い形式もどちらも動作し、現在は `key=value` 形式の方が推奨です。 stgraber@castiana:~$ lxc config set c1 user.foo 1 stgraber@castiana:~$ lxc config get c1 user.foo 1 stgraber@castiana:~$ lxc config set c1 user.foo=2 user.bar=3 stgraber@castiana:~$ lxc config get c1 user.foo 2 stgraber@castiana:~$ lxc config get c1 user.bar 3 #### クライアントのすべてのリスト表示に対する `--format` オプション コマンドラインのもうひとつの改良点は、すべての `list` コマンドが同じように動作するようになり、同じ `--format` オプションが追加されました。次の形式での出力ができます: - table (default) - csv - json - yaml このようなコマンドの一覧: - lxc alias list - lxc cluster list - lxc config template list - lxc config trust list - lxc image list - lxc image alias list - lxc list - lxc network list - lxc network list-leases - lxc operation list - lxc profile list - lxc project list - lxc remote list - lxc storage list - lxc storage volume list #### Simplestream での `combined` イメージのサポート ファイルタイプ `lxd_combined.tar.gz` を使って、simplestream イメージサーバー上で LXD `combined` イメージ(単一の tarball)を公開できるようになりました。 これは、より一般的なメタデータ(`lxd.tar.xz`)と rootfs(`root.tar.xz` もしくは `squashfs`)の個別のファイルから構成される `split` イメージの代替となるものです。 ### バグ修正(翻訳なし) - bash: Update contain er options - bash: Update device options - bash: Update network options - bash: Update server options - bash: Update storage options - doc: Update Github URLs - doc/containers: Fix markdown escaping - doc/containers: Remove incorrect host_name setting from ipvlan and macvlan - doc/containers: Update container volatile keys for host_name - doc/containers/: Update proxy bind settings to host or guest - doc/containers: Update proxy default mode value to 0644 - doc/storage: Make descriptions consistent - doc/userns: Update to match current behavior - i18n: Update translations from weblate - i18n: Update translation templates - lxc/list: If no snapshots, show 0 - lxd: Update Github URLs - lxd/cluster: Use hook for initial heartbeat - lxd/cluster: Workaround watchFunc kicking heartbeat a bit too early - lxd/cluster/hearbeat: Add new RaftID field to heartbeat Members struct - lxd/cluster/membership: Fix new DB server id - lxd/containers: Add access to containerLoadByProjectAndName from device - lxd/containers: Add DevicesPath() function to interface - lxd/containers: Add InstanceLoadNodeAll link to device package - lxd/containers: Add state to containerValidDevices and updates references - lxd/containers: Add Type function - lxd/containers: Add Type() function to interface - lxd/containers: Delete on creation failure - lxd/containers: Don't validate liblxc version during config parsing - lxd/containers: Fix infiniband support - lxd/containers: Link device interface into LXD, removes unused functions - lxd/containers: Move fillNetworkDevice into startInfiniband - lxd/containers: NIC device validation to device interface - lxd/containers: Remove migrated infiniband validation - lxd/containers: Remove old infiniband logic - lxd/containers: Remove proxy validation - lxd/containers: Restore update of disk limit options - lxd/containers: Restructure deviceStop to support post stop hooks - lxd/containers: Rework MAAS calls - lxd/containers: Update infiniband to use device package - lxd/containers: Update references for proxy to use device package - lxd/containers: Update references to deviceGetAttributes to device package - lxd/containers: Update references to proxy functions and vars after move - lxd/containers: Update use of device.New with device name - lxd/containers: Update use of device.New() with device name - lxd/daemon: Check for non-empty members list from heartbeat - lxd/device: Add device interface and common device implementation - lxd/device: Add device name to device structure - lxd/device: Hook up proxy device - lxd/device: Link up infiniband device - lxd/device: Move device related functions into device package - lxd/device: Remove single line if assignments - lxd/device: Remove old static update fields list - lxd/device: Update interface for Stop() to return RunConfig - lxd/device/config: Move types.* to device.config.* - lxd/device/errors: Add errors file for device error definitions - lxd/device/infiniband: Add infiniband device loader - lxd/device/infiniband/physical: Add new infiniband physical implementation - lxd/device/infiniband/sriov: Add infiniband sriov device implementation - lxd/device/instance/id: Add DevicesPath() function - lxd/device/instance/id: Add functions to interface to expose config - lxd/device/instance/id: Add instanceIdentifier interface - lxd/device/instance/id: Add LogPath() to instance identifier interface - lxd/device/nic: Add NIC device loader, nic type map and validation - lxd/device/nic: Rename runConfig to runConf for consistency - lxd/device/nic: Update comments to remove "container" references - lxd/device/nic: Update nic devices to use new RunConfig format - lxd/device/nic/bridged: Add bridged NIC device implementation - lxd/device/nic/bridged: Add checks for DHCP being enabled if no static IP - lxd/device/nic/bridged: Fix issue with non-dhcp, non-addressed parent device - lxd/device/nic/bridged: Update for post stop hooks - lxd/device/nic/ipvlan: Add IPVLAN NIC device implementation - lxd/device/nic/macvlan: Add MACVLAN NIC device implementation - lxd/device/nic/macvlan: Update for post stop hooks - lxd/device/nic/p2p: Add P2P NIC device implementation - lxd/device/nic/p2p: Update for post stop hooks - lxd/device/nic/physical: Add physical NIC device implementation - lxd/device/nic/physical: Update for post stop hooks - lxd/device/nic/sriov: Add SR-IOV NIC device implementation - lxd/device/nic/sriov: Fix mac_filtering when no hwaddr specified - lxd/device/nic/sriov: Switch to use shared instanceGetReservedDevices - lxd/device/nic/sriov: Update for post stop hooks - lxd/device/nic/vlan: Update for post stop hooks - lxd/device/proxy: Add proxy device implementation - lxd/device/proxy: Implement default listen file mode of 0644 - lxd/device/proxy: Remove unnecessary CanHotPlug function - lxd/device/proxy: Update for post stop hooks - lxd/device/runconfig: Add CGroups slice to RunConfig - lxd/device/runconfig: Add MountEntryItem struct definition for mounts - lxd/device/runconfig: Add PostStartHooks and simplifies NetworkInterface - lxd/device/runconfig: Add the struct types returned when a device is started - lxd/device/runconfig: Rename PostStartHooks to PostHooks - lxd/device/utils: Add cidr list validation functions - lxd/device/utils: Add InstanceLoadNodeAll var - lxd/device/utils: Add network{Snapshot,Restore}PhysicalNic and networkRestorePhysicalNic functions - lxd/device/utils: Add NetworkSRIOVGetFreeVFInterface function - lxd/device/utils: Add veth management functions - lxd/device/utils: Bring VLAN parent interface up - lxd/device/utils: Move IP validation functions from network_utils - lxd/device/utils: Move NetworkAttachInterface to device_utils - lxd/device/utils: Move networkGetDevMAC and networkSetDevMAC to device_utils - lxd/device/utils: Move networkGetDevMTU and networkSetDevMTU to device_utils - lxd/device/utils: Move networkGetHostDevice to device_utils - lxd/device/utils: Move networkSysctlGet to device_utils - lxd/device/utils: Move networkSysctlSet to device_utils - lxd/device/utils: Rename createVlanDeviceIfNeeded to NetworkCreateVlanDeviceIfNeeded - lxd/device/utils: Rename deviceNextVeth to NetworkRandomDevName - lxd/device/utils: Rename deviceRemoveInterface to NetworkRemoveInterface - lxd/device/utils/disk: Add disk management utils file - lxd/device/utils/infiniband: Add infiniband utils file - lxd/device/utils/instance: Add access to InstanceLoadByProjectAndName function - lxd/device/utils/instance: Add instanceGetReservedDevices function - lxd/device/utils/network: Move proxy related network functions into device package - lxd/device/utils/proxy: Add proxy specific shared functions - lxd/device/utils/unix: Add unix device utils file - lxd/device/validate: Add device config validation framework - lxd/device/validate: Update validation to understand infiniband has nictype - lxd/dnsmasq: Adds dnsmasq package and updates usage - lxd/dnsmasq: Adds RemoveStaticEntry function - lxd/dnsmasq: Don't fail file deletion if missing - lxd/dnsmasq: Removes RebuildConfig function link to networkUpdateStatic - lxd/images: Fix crash on refresh error - lxd/instance: Add new type instance - lxd/internal: Remove OnNetworkUp hook command - lxd/iptables: Moves iptables helper functions into own package - lxd/maas: Do more configuration validation - lxd/main_checkfeature: Add ifdef SECCOMP_GET_ACTION_AVAIL - lxd/main_forkmount: Error on invalid calls - lxd/main_forkmount: Fix cobra parsing - lxd/main_forkmount: Properly exit on success - lxd/main_forkproxy: Fix crash when listener cannot be setup - lxd/main_forkproxy: Rework log messages to better define the different types - lxd/main_forkproxy: Update references to shared types in device package - lxd/main_forksyscall: Add and use setnsat() - lxd/main_forksyscall: Add chdirchroot() - lxd/main_forksyscall: Avoid calling close on garbage fd - lxd/main_forksyscall: Don't break chdirchroot() with setns(CLONE_NEWNS) - lxd/main_forksyscall: Fix variable declarations - lxd/main_forksyscall: Harden open()-calls via O_PATH and O_DIRECTORY - lxd/main_forksyscall: Introduce acquire_basic_creds() - lxd/main_forksyscall: Protect CLONE_NEWCGROUP with ifdef - lxd/main_forksyscall: Re-introduce setns(CLONE_NEWNS) properly - lxd/main_forksyscall: Remove same_fsinfo() logic completely - lxd/main_forksyscall: Remove st_ino check from same_fsinfo() - lxd/main_forksyscall: Replace target_fd with cwd_fd - lxd/main_forksyscall: Switch chdirchroot() and setns() order - lxd/main_forksyscall: Use correct error handling for chdirchroot() - lxd/networks/config: Update references to NetworkValidAddress - lxd/networks/config: Update to use IP validation in device_utils - lxd/networks/utils: Remove functions that are moved to device implementations - lxd/networks/utils: Remove networkUpdateStaticContainer - lxd/networks/utils: Remove networkValidAddress - lxd/networks/utils: Remove unused IP validation functions - lxd/project: Adds project package and updates references to it - lxd/proxy: Remove unused code - lxd/response: Fix SmartError - lxd/seccomp: Abstract syscall handling - lxd/seccomp: Always use setfattr - lxd/seccomp: Bugfix, cleanup, and simplify - lxd/seccomp: Don't hardcode ns type - lxd/seccomp: Don't mask errors - lxd/seccomp: Fix broken setxattr - lxd/seccomp: Fix setattr of directories - lxd/seccomp: Fix whiteout detection - lxd/seccomp: Handle setxattr syscall - lxd/seccomp: Only define Go arch (and include elf) - lxd/seccomp: Remove shiftfs special-casing - lxd/seccomp: Rename getSeccompProfileContent to seccompGetPolicyContent - lxd/seccomp: Retrieve fs{g,u}id for mknod{at}() syscalls - lxd/seccomp: Retrieve fs{g,u}id for setxattr() syscalls - lxd/seccomp: Use int64 for uid/gid - lxd/seccomp: Use LXD uidmap functions - lxd/storage: Fix hangs on volume migration failures - lxd/storage/ceph: Handle EBUSY on unmap - lxd/storage/ceph: Slightly speed up creation - lxd/storage/zfs: Fix transfer on encrypted pool - lxd/storage/zfs: Properly wrap mount error - lxd/storage/zfs: Properly wrap mount error - lxd/task: Attempt to run tasks on schedule - lxd/task/group: Move wait group Done() after g.running update to avoid race on task end - Makefile: Include libraft and libco - Makefile: Make it easier to build from tarball - Makefile: Rename dist to _dist to avoid Go recursion - Makefile: Update Github URLs - shared: Don't open files to get their mode - shared/container: Add IsNotEmpty to help with validation required fields - shared/container: Add IsUnixUserID and IsOctalFileMode functions - shared/osarch: Add more aliases - shared/util: Remove BlockFsDetect as moved into device package - tests: Add basic infiniband tests - tests: Add nic bridged filtering tests for when DHCP is disabled - tests: Add sleep for DHCP release tests for slower machines - tests: Always pass -f to stop - tests: Always use pg_num=1 during tests - tests: Avoid ceph pool conflict - tests: Avoid event forwarding race condition - tests: Ensure SR-IOV tests remove all containers - tests: Fix bridge tests detection of busybox udhcpc6 presence - tests: Fix CEPH pool names - tests: Fix proxy device unix tests on Ubuntu Eoan - tests: Make shellcheck happy - tests: Rename ct_name to ctName for consistent naming in NIC tests - tests: Rename the proxy device tests to fit with other device tests - tests: Update forkproxy tests - tests: Update nic bridged filtering tests for non-IP addressed parent - tests: Update NIC SR-IOV test to check for device reservation - tests: Update NIC tests to check for volatile key cleanup - tests: Update static_analysis.sh - tests: Workaround race condition in image import event listener ### 試用環境 この新しい LXD リリースは私たちの [デモサービス](https://linuxcontainers.org/ja/lxd/try-it/) で利用できます。 ### ダウンロード このリリースの tarball は [ダウンロードページ](/lxd/downloads/) から取得できます。 ビルド済みバイナリーは次のように使えます: - **Linux:** snap install lxd - **MacOS:** brew install lxc - **Windows:** choco install lxc
Contents