[lxc-devel] [lxd/master] Improve pause help

2016-07-06 Thread tych0 on Github
The following pull request was submitted through Github.
It can be accessed and reviewed at: https://github.com/lxc/lxd/pull/2181

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 dd70184330e3e70bab36363bfe40177ce5b7d56f Mon Sep 17 00:00:00 2001
From: Tycho Andersen 
Date: Wed, 6 Jul 2016 15:35:51 -0600
Subject: [PATCH 1/2] use named args for actionCmds

We'll take advantage of this in the next patch making the diff much
shorter.

Signed-off-by: Tycho Andersen 
---
 lxc/main.go | 55 +--
 1 file changed, 37 insertions(+), 18 deletions(-)

diff --git a/lxc/main.go b/lxc/main.go
index ff8b085..fc2da81 100644
--- a/lxc/main.go
+++ b/lxc/main.go
@@ -155,29 +155,48 @@ type command interface {
 }
 
 var commands = map[string]command{
-   "config":   &configCmd{},
-   "copy": ©Cmd{},
-   "delete":   &deleteCmd{},
-   "exec": &execCmd{},
-   "file": &fileCmd{},
-   "finger":   &fingerCmd{},
-   "help": &helpCmd{},
-   "image":&imageCmd{},
-   "info": &infoCmd{},
-   "init": &initCmd{},
-   "launch":   &launchCmd{},
-   "list": &listCmd{},
-   "monitor":  &monitorCmd{},
-   "move": &moveCmd{},
-   "pause":&actionCmd{shared.Freeze, false, false, "pause", -1, false, 
false, false},
+   "config":  &configCmd{},
+   "copy":©Cmd{},
+   "delete":  &deleteCmd{},
+   "exec":&execCmd{},
+   "file":&fileCmd{},
+   "finger":  &fingerCmd{},
+   "help":&helpCmd{},
+   "image":   &imageCmd{},
+   "info":&infoCmd{},
+   "init":&initCmd{},
+   "launch":  &launchCmd{},
+   "list":&listCmd{},
+   "monitor": &monitorCmd{},
+   "move":&moveCmd{},
+   "pause": &actionCmd{
+   action:  shared.Freeze,
+   name:"pause",
+   },
"profile":  &profileCmd{},
"publish":  &publishCmd{},
"remote":   &remoteCmd{},
-   "restart":  &actionCmd{shared.Restart, true, true, "restart", -1, 
false, false, false},
+   "restart":  &actionCmd{
+   action: shared.Restart,
+   hasTimeout: true,
+   visible: true,
+   name: "restart",
+   timeout: -1,
+   },
"restore":  &restoreCmd{},
"snapshot": &snapshotCmd{},
-   "start":&actionCmd{shared.Start, false, true, "start", -1, false, 
false, false},
-   "stop": &actionCmd{shared.Stop, true, true, "stop", -1, false, 
false, false},
+   "start":&actionCmd{
+   action: shared.Start,
+   visible: true,
+   name: "start",
+   },
+   "stop": &actionCmd{
+   action: shared.Stop,
+   hasTimeout: true,
+   visible: true,
+   name: "stop",
+   timeout: -1,
+   },
"version":  &versionCmd{},
 }
 

From 27ff38d0a670c867a59cf292d2ee241423ddbee7 Mon Sep 17 00:00:00 2001
From: Tycho Andersen 
Date: Wed, 6 Jul 2016 16:27:09 -0600
Subject: [PATCH 2/2] add some additional help to `lxc pause`

Signed-off-by: Tycho Andersen 
---
 lxc/action.go | 23 ++-
 lxc/main.go   | 39 ---
 2 files changed, 34 insertions(+), 28 deletions(-)

diff --git a/lxc/action.go b/lxc/action.go
index 6858bc9..8fece38 100644
--- a/lxc/action.go
+++ b/lxc/action.go
@@ -10,14 +10,15 @@ import (
 )
 
 type actionCmd struct {
-   action shared.ContainerAction
-   hasTimeout bool
-   visiblebool
-   name   string
-   timeoutint
-   force  bool
-   stateful   bool
-   stateless  bool
+   action shared.ContainerAction
+   hasTimeout bool
+   visiblebool
+   name   string
+   timeoutint
+   force  bool
+   stateful   bool
+   stateless  bool
+   additionalHelp string
 }
 
 func (c *actionCmd) showByDefault() bool {
@@ -25,10 +26,14 @@ func (c *actionCmd) showByDefault() bool {
 }
 
 func (c *actionCmd) usage() string {
+   if c.additionalHelp != "" {
+   c.additionalHelp = fmt.Sprintf("\n\n%s", c.additionalHelp)
+   }
+
return fmt.Sprintf(i18n.G(
`Changes state of one or more containers to %s.
 
-lxc %s  [...]`), c.name, c.name)
+lxc %s  [...]%s`), c.name, c.name, c.additionalHelp)
 }
 
 func (c *actionCmd) flags() {
diff --git a/lxc/main.go b/lxc/main.go
index fc2da81..4938a0f 100644
--- a/lxc/main.go
+++ b/lxc/main.go
@@ -170,34 +170,35 @@ var commands = map[string]command{
"monitor": &monitorCmd{},
"move":&moveCmd{},
"pause": &actionCmd{
-   action:  shared.Freeze,
-   name:"pause",
+   action: shared.Freeze,
+

[lxc-devel] [lxc/master] Set up MTU for vlan-type interfaces.

2016-07-06 Thread vel21ripn on Github
The following pull request was submitted through Github.
It can be accessed and reviewed at: https://github.com/lxc/lxc/pull/1074

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 76f5b64eae59851c7ee4cd46d6e6a1b50faa3209 Mon Sep 17 00:00:00 2001
From: Vitaly Lavrov 
Date: Thu, 30 Jun 2016 20:04:49 +0300
Subject: [PATCH] Set up MTU for vlan-type interfaces.

---
 src/lxc/conf.c | 10 ++
 1 file changed, 10 insertions(+)

diff --git a/src/lxc/conf.c b/src/lxc/conf.c
index e8dfaae..d1f136e 100644
--- a/src/lxc/conf.c
+++ b/src/lxc/conf.c
@@ -2741,6 +2741,16 @@ static int instantiate_vlan(struct lxc_handler *handler, 
struct lxc_netdev *netd
 
DEBUG("instantiated vlan '%s', ifindex is '%d'", " vlan1000",
  netdev->ifindex);
+   if (netdev->mtu) {
+   int mtu = atoi(netdev->mtu);
+   err = mtu > 64 && mtu < 65536 ? lxc_netdev_set_mtu(peer,mtu) : 
EINVAL;
+   if(err) {
+   ERROR("failed to set mtu '%s' for %s : %s",
+ netdev->mtu, peer, strerror(-err));
+   lxc_netdev_delete_by_name(peer);
+   return -1;
+   }
+   }
 
return 0;
 }
___
lxc-devel mailing list
lxc-devel@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-devel