lxc-ls続き。

lxcのリポジトリを見てみたら、Debianのバグではなく、Upstreamの方のバグだった。いや、正確にいうと仕様変更だった。

http://lxc.git.sourceforge.net/git/gitweb.cgi?p=lxc/lxc;a=commitdiff;h=65cb447f9b8d1ac8dcf9df24a4f877180444f003

With previous changes that allow to start a container

without the need to create it; the lxc-ls was only reporting

the created containers.

With this patch, the lxc-ls is now reporting created and active

containers.

diff --git a/src/lxc/lxc-ls.in b/src/lxc/lxc-ls.in
index 6a77ebe..7d2dad0 100644 (file)
--- a/src/lxc/lxc-ls.in
+++ b/src/lxc/lxc-ls.in
@@ -6,4 +6,26 @@ if [ ! -r $lxcpath ]; then
     exit 0
 fi
+function get_cgroup()
+{
+       local mount_string
+       mount_string=$(mount -t cgroup |grep -E -e '^lxc ')
+       if test -z "$mount_string"; then
+               mount_string=$(mount |grep -m1 'type cgroup')
+       fi
+       if test -n "$mount_string"; then
+               mount_point=$(echo $mount_string |cut -d' ' -f3)
+       fi
+}
+
ls $* $lxcpath
+
+active=$(netstat -xa | grep $lxcpath | \
+       sed -e 's#.*'"$lxcpath/"'\(.*\)/command#\1#');
+
+if test -n "$active"; then
+       get_cgroup
+       if test -n "$mount_point"; then
+               cd $mount_point; ls $* -d $active
+       fi
+fi

でもこの表示形式だと、なんで2回表示されるのか分からんぜ。changelog.Debian.gzにもないし。

同じコンテナが2回表示される。

$ lxc-ls
guest0  guest1  guest2  guest3  guest4
guest0  guest1  guest2  guest3  guest4

なんじゃ?と思ったら、lxc-lsコマンドの中でおかしな一行が。

#!/bin/bash

lxcpath=/var/lib/lxc

if [ ! -r $lxcpath ]; then
    exit 0
fi

function get_cgroup()
{
        local mount_string
        mount_string=$(mount -t cgroup |grep -E -e '^lxc ')
        if test -z "$mount_string"; then
                mount_string=$(mount |grep -m1 'type cgroup')
        fi
        if test -n "$mount_string"; then
                mount_point=$(echo $mount_string |cut -d' ' -f3)
        fi
}

ls $* $lxcpath

active=$(netstat -xa | grep $lxcpath | \
        sed -e 's#.*'"$lxcpath/"'\(.*\)/command#\1#');

if test -n "$active"; then
        get_cgroup
        if test -n "$mount_point"; then
                cd $mount_point; ls $* -d $active
        fi
fi

“ls $* $lxcpath”とかやってるし。デバッグ用につけたのを消し忘れたのかな。

久々に口唇ヘルペス。

髭剃ったのが直接的な影響ではあるだろうが、午後仕事していて痛むなぁと思ったらあっという間に右の口角に口唇ヘルペスが…。帰宅してからは眩暈もするし。また風邪ひいたか、疲れが溜まってるのかな。

お昼の日課にDDTSS。

DDTSS の翻訳作業ならお昼休みにできるなぁと先日気づいたので、自席で昼食を取るときはこれを日課にすることにした。

検証用環境でのプロトタイプ開発時に必要なパッケージをインストールする際に、apt-cache showで日本語化されているか否かを確認するのがやるかやんないかの判断ポイント。自分で使ったパッケージならDescriptionに書いていることも理解できるので。

髭とオサラバ。

諸事情で1年と19日振りに髭を剃ったなう。でも今週末にはまたうっすら髭が生えていることであろう。髭剃る前にこまめに髭を舐めてもらっている記念写真をヨメに撮っておいてもらった。