install -m 755 lib/lxcf-rename $(DESTDIR)$(libdir)/lxcf/lxcf-rename
install -m 755 lib/lxcf-snapshot-pull $(DESTDIR)$(libdir)/lxcf/lxcf-snapshot-pull
install -m 755 lib/lxcf-find-init $(DESTDIR)$(libdir)/lxcf/lxcf-find-init
+ install -m 755 lib/lxcf-add-ipaddr $(DESTDIR)$(libdir)/lxcf/lxcf-add-ipaddr
+ install -m 755 lib/lxcf-del-ipaddr $(DESTDIR)$(libdir)/lxcf/lxcf-del-ipaddr
install_sbin_lxcf: .prepare
install -d -m 755 $(DESTDIR)$(sbindir)
install -m 755 cmd/api $(DESTDIR)$(libdir)/lxcf/sbin/api
install -m 755 cmd/api-passwd $(DESTDIR)$(libdir)/lxcf/sbin/api-passwd
install -m 755 cmd/snapshot-pull $(DESTDIR)$(libdir)/lxcf/sbin/snapshot-pull
+ install -m 755 cmd/add-ipaddr $(DESTDIR)$(libdir)/lxcf/sbin/add-ipaddr
+ install -m 755 cmd/del-ipaddr $(DESTDIR)$(libdir)/lxcf/sbin/del-ipaddr
install_conf: .prepare
install -m 644 conf/helpfile.txt $(DESTDIR)$(libdir)/lxcf/helpfile.txt
--- /dev/null
+#!/bin/bash
+# copyright (C) 2014 FUJITSU LIMITED All Rights Reserved
+
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; version 2
+# of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+# 02110-1301, USA.
+
+# check root
+if [ ${EUID:-${UID}} != 0 ]; then
+ echo "error: Because you are not root, you cannot execute this command. "
+ exit 1
+fi
+
+/usr/lib64/lxcf/lxcf-add-ipaddr $*
+
+exit $?
+
--- /dev/null
+#!/bin/bash
+# copyright (C) 2014 FUJITSU LIMITED All Rights Reserved
+
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; version 2
+# of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+# 02110-1301, USA.
+
+# check root
+if [ ${EUID:-${UID}} != 0 ]; then
+ echo "error: Because you are not root, you cannot execute this command. "
+ exit 1
+fi
+
+/usr/lib64/lxcf/lxcf-del-ipaddr $*
+
+exit $?
+
--- /dev/null
+#!/bin/bash
+# copyright (C) 2013-2014 FUJITSU LIMITED All Rights Reserved
+
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; version 2
+# of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+# 02110-1301, USA.
+
+# check distro
+DISTRO=`/usr/lib64/lxcf/lxcf-distro`
+
+# check root
+if [ ${EUID:-${UID}} != 0 ]; then
+ echo "error: Because you are not root, you cannot execute this command. "
+ exit 1
+fi
+
+# check args
+if [ $# -ne 4 ]; then
+ echo "usage: lxcf-add-ipaddr CONTAINER_NAME Number IPADDR BRIDGHE "
+ exit -1
+fi
+
+LXCNAME=$1
+LXCNUM=$2
+LXCIP=$3
+LXCBR=$4
+LXCBRIP=`echo $3 | awk -F . '{printf "%s.%s.%s.1\n",$1,$2,$3}'`
+
+LXCPROC=`/usr/lib64/lxcf/lxcf-find-init $LXCNAME`
+if [ $? -ne 0 ]; then
+ echo "error: can't find" $LXCNAME
+ exit -1
+fi
+
+mkdir -p /var/run/netns/
+ln -s /proc/${LXCPROC}/ns/net /var/run/netns/$LXCNAME
+
+brctl show $LXCBR |& egrep 'No such device' >& /dev/null
+if [ $? -eq 0 ]; then
+ brctl addbr $LXCBR
+ ip link set $LXCBR up
+ ip addr add ${LXCBRIP}/24 dev $LXCBR
+fi
+
+brctl show $LXCBR |& egrep vh${LXCNAME}${LXCNUM} >& /dev/null
+if [ $? -eq 0 ]; then
+ ip link delete vh${LXCNAME}${LXCNUM} type veth
+fi
+
+ip link add name vh${LXCNAME}${LXCNUM} type veth peer name vg${LXCNAME}${LXCNUM}
+ip link set vh${LXCNAME}${LXCNUM} up
+brctl addif $LXCBR vh${LXCNAME}${LXCNUM}
+
+ip link set vg${LXCNAME}${LXCNUM} netns $LXCNAME
+
+# Setting of network in container
+ip netns exec $LXCNAME ip link set vg${LXCNAME}${LXCNUM} name eth${LXCNUM}
+
+ip netns exec $LXCNAME ip addr add ${LXCIP}/24 dev eth${LXCNUM}
+ip netns exec $LXCNAME ip link set eth${LXCNUM} up
+ip netns exec $LXCNAME ip route delete default >& /dev/null
+ip netns exec $LXCNAME ip route add default via ${LXCBRIP}
+
+rm -f /var/run/netns/$LXCNAME
+
+exit 0
--- /dev/null
+#!/bin/bash
+# copyright (C) 2013-2014 FUJITSU LIMITED All Rights Reserved
+
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; version 2
+# of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+# 02110-1301, USA.
+
+# check distro
+DISTRO=`/usr/lib64/lxcf/lxcf-distro`
+
+# check root
+if [ ${EUID:-${UID}} != 0 ]; then
+ echo "error: Because you are not root, you cannot execute this command. "
+ exit 1
+fi
+
+# check args
+if [ $# -ne 2 ]; then
+ echo "usage: lxcf-del-ipaddr CONTAINER_NAME Number"
+ exit -1
+fi
+
+LXCNAME=$1
+LXCNUM=$2
+brctl show $LXCBR |& egrep vh${LXCNAME}${LXCNUM} >& /dev/null
+if [ $? -ne 0 ]; then
+ echo "error: can't find" vh${LXCNAME}${LXCNUM}
+ exit -1
+fi
+
+ip link delete vh${LXCNAME}${LXCNUM} type veth
+
+exit 0
#!/bin/bash
-# copyright (C) 2013-2014 FUJITSU LIMITED All Rights Reserved
+# copyright (C) 2014 FUJITSU LIMITED All Rights Reserved
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
%doc README COPYING ChangeLog AUTHORS example
%changelog
-* Thu Nov 14 2014 NIWA Hideyuki <niwa.hideyuki@jp.fujitsu.com> - 0.11-1
+* Fri Nov 14 2014 NIWA Hideyuki <niwa.hideyuki@jp.fujitsu.com> - 0.11-1
- New Build. update to release 0.11-1
* Thu Sep 25 2014 NIWA Hideyuki <niwa.hideyuki@jp.fujitsu.com> - 0.10-1