[lxc-devel] [lxd/master] Add boot.priority

stgraber on Github lxc-bot at linuxcontainers.org
Mon Jan 20 14:36:25 UTC 2020


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 301 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20200120/e51fa699/attachment.bin>
-------------- next part --------------
From 4e08e6364f51aad0bbd436292e9ab54723d1e59b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Mon, 20 Jan 2020 16:34:31 +0200
Subject: [PATCH 1/3] doc/api-extensions: Fix syntax
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Stéphane Graber <stgraber at ubuntu.com>
---
 doc/api-extensions.md | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/doc/api-extensions.md b/doc/api-extensions.md
index 5b3c2e5331..a2bc88793a 100644
--- a/doc/api-extensions.md
+++ b/doc/api-extensions.md
@@ -895,7 +895,7 @@ This adds a new `architecture` attribute to cluster members which indicates a cl
 member's architecture.
 
 ## resources\_disk\_id
-Add a new device_id field in the disk entries on the resources API.
+Add a new device\_id field in the disk entries on the resources API.
 
 ## storage\_lvm\_stripes
 This adds the ability to use LVM stripes on normal volumes and thin pool volumes.

From bd7ba0fffd2c4e37d88773cb4222a5bc26622de6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Mon, 20 Jan 2020 16:35:28 +0200
Subject: [PATCH 2/3] api: vm_boot_priority
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Stéphane Graber <stgraber at ubuntu.com>
---
 doc/api-extensions.md | 3 +++
 shared/version/api.go | 1 +
 2 files changed, 4 insertions(+)

diff --git a/doc/api-extensions.md b/doc/api-extensions.md
index a2bc88793a..a5dad365ea 100644
--- a/doc/api-extensions.md
+++ b/doc/api-extensions.md
@@ -899,3 +899,6 @@ Add a new device\_id field in the disk entries on the resources API.
 
 ## storage\_lvm\_stripes
 This adds the ability to use LVM stripes on normal volumes and thin pool volumes.
+
+## vm\_boot\_priority
+Adds a `boot.priority` property on nic and disk devices to control the boot order.
diff --git a/shared/version/api.go b/shared/version/api.go
index 95985665cb..b06864911b 100644
--- a/shared/version/api.go
+++ b/shared/version/api.go
@@ -183,6 +183,7 @@ var APIExtensions = []string{
 	"clustering_architecture",
 	"resources_disk_id",
 	"storage_lvm_stripes",
+	"vm_boot_priority",
 }
 
 // APIExtensionsCount returns the number of available API extensions.

From 6bec0d966fc7d98be4cf9a1068ec4b3e492ce5cc Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Mon, 20 Jan 2020 16:33:57 +0200
Subject: [PATCH 3/3] lxd/vm: Add boot.priority
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Stéphane Graber <stgraber at ubuntu.com>
---
 doc/instances.md           | 6 ++++++
 lxd/device/disk.go         | 1 +
 lxd/device/nic.go          | 1 +
 lxd/device/nic_bridged.go  | 1 +
 lxd/device/nic_macvlan.go  | 2 +-
 lxd/device/nic_physical.go | 1 +
 lxd/device/nic_sriov.go    | 1 +
 scripts/bash/lxd-client    | 3 ++-
 8 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/doc/instances.md b/doc/instances.md
index e845ae0b92..08149c0f24 100644
--- a/doc/instances.md
+++ b/doc/instances.md
@@ -272,6 +272,7 @@ hwaddr                  | string    | randomly assigned | no        | The MAC ad
 vlan                    | integer   | -                 | no        | The VLAN ID to attach to
 maas.subnet.ipv4        | string    | -                 | no        | MAAS IPv4 subnet to register the instance in
 maas.subnet.ipv6        | string    | -                 | no        | MAAS IPv6 subnet to register the instance in
+boot.priority           | integer   | -                 | no        | Boot priority for VMs (higher boots first)
 
 #### nictype: bridged
 Uses an existing bridge on the host and creates a virtual device pair to connect the host bridge to the instance.
@@ -297,6 +298,7 @@ security.ipv4\_filtering | boolean   | false             | no        | Prevent t
 security.ipv6\_filtering | boolean   | false             | no        | Prevent the instance from spoofing another's IPv6 address (enables mac\_filtering)
 maas.subnet.ipv4         | string    | -                 | no        | MAAS IPv4 subnet to register the instance in
 maas.subnet.ipv6         | string    | -                 | no        | MAAS IPv6 subnet to register the instance in
+boot.priority            | integer   | -                 | no        | Boot priority for VMs (higher boots first)
 
 #### nictype: macvlan
 Sets up a new network device based on an existing one but using a different MAC address.
@@ -312,6 +314,7 @@ hwaddr                  | string    | randomly assigned | no        | The MAC ad
 vlan                    | integer   | -                 | no        | The VLAN ID to attach to
 maas.subnet.ipv4        | string    | -                 | no        | MAAS IPv4 subnet to register the instance in
 maas.subnet.ipv6        | string    | -                 | no        | MAAS IPv6 subnet to register the instance in
+boot.priority           | integer   | -                 | no        | Boot priority for VMs (higher boots first)
 
 #### nictype: ipvlan
 Sets up a new network device based on an existing one using the same MAC address but a different IP.
@@ -365,6 +368,7 @@ limits.egress           | string    | -                 | no        | I/O limit
 limits.max              | string    | -                 | no        | Same as modifying both limits.ingress and limits.egress
 ipv4.routes             | string    | -                 | no        | Comma delimited list of IPv4 static routes to add on host to nic
 ipv6.routes             | string    | -                 | no        | Comma delimited list of IPv6 static routes to add on host to nic
+boot.priority           | integer   | -                 | no        | Boot priority for VMs (higher boots first)
 
 #### nictype: sriov
 Passes a virtual function of an SR-IOV enabled physical network device into the instance.
@@ -381,6 +385,7 @@ security.mac\_filtering | boolean   | false             | no        | Prevent th
 vlan                    | integer   | -                 | no        | The VLAN ID to attach to
 maas.subnet.ipv4        | string    | -                 | no        | MAAS IPv4 subnet to register the instance in
 maas.subnet.ipv6        | string    | -                 | no        | MAAS IPv6 subnet to register the instance in
+boot.priority           | integer   | -                 | no        | Boot priority for VMs (higher boots first)
 
 #### nictype: routed
 This NIC type is similar in operation to IPVLAN, in that it allows an instance to join an external network without needing to configure a bridge and shares the host's MAC address.
@@ -572,6 +577,7 @@ shift               | boolean   | false     | no        | Setup a shifting overl
 raw.mount.options   | string    | -         | no        | Filesystem specific mount options
 ceph.user\_name     | string    | admin     | no        | If source is ceph or cephfs then ceph user\_name must be specified by user for proper mount
 ceph.cluster\_name  | string    | admin     | no        | If source is ceph or cephfs then ceph cluster\_name must be specified by user for proper mount
+boot.priority       | integer   | -         | no        | Boot priority for VMs (higher boots first)
 
 ### Type: unix-char
 Unix character device entries simply make the requested character device
diff --git a/lxd/device/disk.go b/lxd/device/disk.go
index 508b31bc0a..c0fff8f6c5 100644
--- a/lxd/device/disk.go
+++ b/lxd/device/disk.go
@@ -82,6 +82,7 @@ func (d *disk) validateConfig() error {
 		"raw.mount.options": shared.IsAny,
 		"ceph.cluster_name": shared.IsAny,
 		"ceph.user_name":    shared.IsAny,
+		"boot.priority":     shared.IsUint32,
 	}
 
 	// VMs don't use the "path" property, but containers need it, so if we are validating a profile that can
diff --git a/lxd/device/nic.go b/lxd/device/nic.go
index 7f7f942ebc..562ee7a08a 100644
--- a/lxd/device/nic.go
+++ b/lxd/device/nic.go
@@ -47,6 +47,7 @@ func nicValidationRules(requiredFields []string, optionalFields []string) map[st
 		"ipv6.address":            NetworkValidAddressV6,
 		"ipv4.routes":             NetworkValidNetworkV4List,
 		"ipv6.routes":             NetworkValidNetworkV6List,
+		"boot.priority":           shared.IsUint32,
 	}
 
 	validators := map[string]func(value string) error{}
diff --git a/lxd/device/nic_bridged.go b/lxd/device/nic_bridged.go
index d34d7d6aeb..bad7d9ff5f 100644
--- a/lxd/device/nic_bridged.go
+++ b/lxd/device/nic_bridged.go
@@ -71,6 +71,7 @@ func (d *nicBridged) validateConfig() error {
 		"security.ipv6_filtering",
 		"maas.subnet.ipv4",
 		"maas.subnet.ipv6",
+		"boot.priority",
 	}
 	err := d.config.Validate(nicValidationRules(requiredFields, optionalFields))
 	if err != nil {
diff --git a/lxd/device/nic_macvlan.go b/lxd/device/nic_macvlan.go
index fb7b87d21d..d59ad57bb0 100644
--- a/lxd/device/nic_macvlan.go
+++ b/lxd/device/nic_macvlan.go
@@ -19,7 +19,7 @@ func (d *nicMACVLAN) validateConfig() error {
 	}
 
 	requiredFields := []string{"parent"}
-	optionalFields := []string{"name", "mtu", "hwaddr", "vlan", "maas.subnet.ipv4", "maas.subnet.ipv6"}
+	optionalFields := []string{"name", "mtu", "hwaddr", "vlan", "maas.subnet.ipv4", "maas.subnet.ipv6", "boot.priority"}
 	err := d.config.Validate(nicValidationRules(requiredFields, optionalFields))
 	if err != nil {
 		return err
diff --git a/lxd/device/nic_physical.go b/lxd/device/nic_physical.go
index 8376da3a07..ebb465b70a 100644
--- a/lxd/device/nic_physical.go
+++ b/lxd/device/nic_physical.go
@@ -26,6 +26,7 @@ func (d *nicPhysical) validateConfig() error {
 		"vlan",
 		"maas.subnet.ipv4",
 		"maas.subnet.ipv6",
+		"boot.priority",
 	}
 	err := d.config.Validate(nicValidationRules(requiredFields, optionalFields))
 	if err != nil {
diff --git a/lxd/device/nic_sriov.go b/lxd/device/nic_sriov.go
index 1079b9773f..508036d799 100644
--- a/lxd/device/nic_sriov.go
+++ b/lxd/device/nic_sriov.go
@@ -37,6 +37,7 @@ func (d *nicSRIOV) validateConfig() error {
 		"security.mac_filtering",
 		"maas.subnet.ipv4",
 		"maas.subnet.ipv6",
+		"boot.priority",
 	}
 	err := d.config.Validate(nicValidationRules(requiredFields, optionalFields))
 	if err != nil {
diff --git a/scripts/bash/lxd-client b/scripts/bash/lxd-client
index b437c10524..65de585d16 100644
--- a/scripts/bash/lxd-client
+++ b/scripts/bash/lxd-client
@@ -114,7 +114,8 @@ _have lxc && {
       security.ipv4_filtering security.ipv6_filtering vlan limits.read \
       limits.write path source optional readonly size recursive pool \
       propagation shift major minor uid gid mode required vendorid productid \
-      pci id listen connect bind nat proxy_protocol security.uid security.gid"
+      pci id listen connect bind nat proxy_protocol security.uid security.gid \
+      boot.priority"
 
     networks_keys="bridge.driver bridge.external_interfaces bridge.mode \
       bridge.mtu bridge.hwaddr dns.domain dns.mode fan.overlay_subnet fan.type \


More information about the lxc-devel mailing list