[lxc-devel] [lxd/master] Random bits from my network branch
stgraber on Github
lxc-bot at linuxcontainers.org
Wed Sep 14 22:09:07 UTC 2016
A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 387 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20160914/7d793908/attachment.bin>
-------------- next part --------------
From 917e3b13c09c03295b4573922d811d4f078a27db Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Thu, 8 Sep 2016 00:09:10 -0400
Subject: [PATCH 1/2] shared: Export type checking functions
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>
---
shared/container.go | 76 ++++++++++++++++++++++++++---------------------------
1 file changed, 38 insertions(+), 38 deletions(-)
diff --git a/shared/container.go b/shared/container.go
index 348ba6b..eb8de7c 100644
--- a/shared/container.go
+++ b/shared/container.go
@@ -150,7 +150,7 @@ type ProfileConfig struct {
Devices Devices `json:"devices"`
}
-func isInt64(value string) error {
+func IsInt64(value string) error {
if value == "" {
return nil
}
@@ -163,7 +163,7 @@ func isInt64(value string) error {
return nil
}
-func isPriority(value string) error {
+func IsPriority(value string) error {
if value == "" {
return nil
}
@@ -180,7 +180,7 @@ func isPriority(value string) error {
return nil
}
-func isBool(value string) error {
+func IsBool(value string) error {
if value == "" {
return nil
}
@@ -192,7 +192,7 @@ func isBool(value string) error {
return nil
}
-func isOneOf(value string, valid []string) error {
+func IsOneOf(value string, valid []string) error {
if value == "" {
return nil
}
@@ -204,7 +204,7 @@ func isOneOf(value string, valid []string) error {
return nil
}
-func isAny(value string) error {
+func IsAny(value string) error {
return nil
}
@@ -212,47 +212,47 @@ func isAny(value string) error {
// to an appropriate checker function, which validates whether or not a
// given value is syntactically legal.
var KnownContainerConfigKeys = map[string]func(value string) error{
- "boot.autostart": isBool,
- "boot.autostart.delay": isInt64,
- "boot.autostart.priority": isInt64,
- "boot.host_shutdown_timeout": isInt64,
+ "boot.autostart": IsBool,
+ "boot.autostart.delay": IsInt64,
+ "boot.autostart.priority": IsInt64,
+ "boot.host_shutdown_timeout": IsInt64,
- "limits.cpu": isAny,
- "limits.cpu.allowance": isAny,
- "limits.cpu.priority": isPriority,
+ "limits.cpu": IsAny,
+ "limits.cpu.allowance": IsAny,
+ "limits.cpu.priority": IsPriority,
- "limits.disk.priority": isPriority,
+ "limits.disk.priority": IsPriority,
- "limits.memory": isAny,
+ "limits.memory": IsAny,
"limits.memory.enforce": func(value string) error {
- return isOneOf(value, []string{"soft", "hard"})
+ return IsOneOf(value, []string{"soft", "hard"})
},
- "limits.memory.swap": isBool,
- "limits.memory.swap.priority": isPriority,
+ "limits.memory.swap": IsBool,
+ "limits.memory.swap.priority": IsPriority,
- "limits.network.priority": isPriority,
+ "limits.network.priority": IsPriority,
- "limits.processes": isInt64,
+ "limits.processes": IsInt64,
- "linux.kernel_modules": isAny,
+ "linux.kernel_modules": IsAny,
- "security.nesting": isBool,
- "security.privileged": isBool,
+ "security.nesting": IsBool,
+ "security.privileged": IsBool,
- "security.syscalls.blacklist_default": isBool,
- "security.syscalls.blacklist_compat": isBool,
- "security.syscalls.blacklist": isAny,
- "security.syscalls.whitelist": isAny,
+ "security.syscalls.blacklist_default": IsBool,
+ "security.syscalls.blacklist_compat": IsBool,
+ "security.syscalls.blacklist": IsAny,
+ "security.syscalls.whitelist": IsAny,
// Caller is responsible for full validation of any raw.* value
- "raw.apparmor": isAny,
- "raw.lxc": isAny,
- "raw.seccomp": isAny,
-
- "volatile.apply_template": isAny,
- "volatile.base_image": isAny,
- "volatile.last_state.idmap": isAny,
- "volatile.last_state.power": isAny,
+ "raw.apparmor": IsAny,
+ "raw.lxc": IsAny,
+ "raw.seccomp": IsAny,
+
+ "volatile.apply_template": IsAny,
+ "volatile.base_image": IsAny,
+ "volatile.last_state.idmap": IsAny,
+ "volatile.last_state.power": IsAny,
}
// ConfigKeyChecker returns a function that will check whether or not
@@ -268,20 +268,20 @@ func ConfigKeyChecker(key string) (func(value string) error, error) {
if strings.HasPrefix(key, "volatile.") {
if strings.HasSuffix(key, ".hwaddr") {
- return isAny, nil
+ return IsAny, nil
}
if strings.HasSuffix(key, ".name") {
- return isAny, nil
+ return IsAny, nil
}
}
if strings.HasPrefix(key, "environment.") {
- return isAny, nil
+ return IsAny, nil
}
if strings.HasPrefix(key, "user.") {
- return isAny, nil
+ return IsAny, nil
}
return nil, fmt.Errorf("Bad key: %s", key)
From 54b8dd65ba22987bfe7f199543cd950fe0f62c71 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Wed, 14 Sep 2016 18:06:01 -0400
Subject: [PATCH 2/2] lxc: Drop unused httpAddr property
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>
---
lxc/config.go | 1 -
lxc/move.go | 1 -
lxc/profile.go | 1 -
lxc/remote.go | 1 -
4 files changed, 4 deletions(-)
diff --git a/lxc/config.go b/lxc/config.go
index 3c8a8bf..fff621e 100644
--- a/lxc/config.go
+++ b/lxc/config.go
@@ -21,7 +21,6 @@ import (
)
type configCmd struct {
- httpAddr string
expanded bool
}
diff --git a/lxc/move.go b/lxc/move.go
index 42f85f1..c997790 100644
--- a/lxc/move.go
+++ b/lxc/move.go
@@ -6,7 +6,6 @@ import (
)
type moveCmd struct {
- httpAddr string
}
func (c *moveCmd) showByDefault() bool {
diff --git a/lxc/profile.go b/lxc/profile.go
index 377644b..7d672d5 100644
--- a/lxc/profile.go
+++ b/lxc/profile.go
@@ -16,7 +16,6 @@ import (
)
type profileCmd struct {
- httpAddr string
}
func (c *profileCmd) showByDefault() bool {
diff --git a/lxc/remote.go b/lxc/remote.go
index 5bf8ff8..cca486a 100644
--- a/lxc/remote.go
+++ b/lxc/remote.go
@@ -24,7 +24,6 @@ import (
)
type remoteCmd struct {
- httpAddr string
acceptCert bool
password string
public bool
More information about the lxc-devel
mailing list