lxc-clone: fix the '--name' parameter

The long opt for --name was being incorrectly compared to --new.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
link /dev/kmsg to /dev/console in the container

This way init log messages can be seen on the console.  If containerized
syslog ever comes around, we can get rid of this.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
api shutdown: don't c->stop() if already stopped.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Support individual hook types in clear_config_item

Without this patch, only clear_config_item("lxc.hook") works.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
try to better handle out of date container caches.

For a lucid container, apt-get update before installing the source package for
add-apt-repository, so that apt-get does not fail.

If apt-get dist-upgrade fails, suggest running lxc-create with -F.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
lxc-debian: specify isc-dhcp-server in package list

dhcp3-client does not exist in testing.

Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/lxc/+bug/1052972

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
lxc-ubuntu: fix printing of default user

If a user is bound into the container, don't claim the default user is
ubuntu.

Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/lxc/+bug/1052315

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Allow short -h and -n options to lxc-ps

Signed-off-by: Dwight Engen <dwight.engen@oracle.com>
lxc-ls: Scan cgroup mount points from fstype and not device

lxc-ls --active now scans mount points that have the 'cgroup' filesystem
type and not the 'cgroup' device name (which is ignored anyway and may be
anything).

Signed-off-by: Christian Seiler <christian@iwakd.de>
Cc: Serge Hallyn <serge.hallyn@ubuntu.com>
lxc-debian: replace isc-dhcp-server by isc-dhcp-client

The DHCP client should be isc-dhcp-client, not isc-dhcp-server.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
fix minor spelling error

Signed-off-by: Dwight Engen <dwight.engen@oracle.com>
if the rootfs is a btrfs subvolume, delete it instead of rm -rf

Check if the rootfs is btrfs subvolume, and if so delete it. Otherwise
fall back to the rm -rf.

Signed-off-by: Dwight Engen <dwight.engen@oracle.com>
handle clone of btrfs snapshots

Fix determination of $oldroot from the config file. The old code had the '
in the wrong place and didn't account for whitespace between the = and
the rootfs.

Set $rootfs based on $oldroot instead of forcing it to be in
$lxc_path/$lxc_new/rootfs. This allows for btrfs snapshot to be made even if
$lxc_path isn't on the same filesystem. If $oldroot isn't a subvolume,
fall back to making a copy.

Signed-off-by: Dwight Engen <dwight.engen@oracle.com>
templates: mount devtmpfs in ubuntu containers

That way /dev/disk/ exists, and update-grub can succeed.

Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/grub2/+bug/1060404
display warning when yum missing in fedora template

This early exit is preventing the warning message that follows it from
being shown.

Signed-off-by: Dwight Engen <dwight.engen@oracle.com>
add oracle template  (From: Dwight Engen)

This is a new template to create containers based on Oracle Linux. A version
such as 5.8, 6.3, or 6.latest can be specified with -R in which case a rootfs
will be created from rpms downloaded from the Oracle public-yum repo.
Alternatively the path to an existing rootfs of Oracle 5 or 6 may be given to
the template with the -t option.

The architecture of the downloaded rpms installed in the container can be
specified with the -a template option.

Signed-off-by: Dwight Engen <dwight.engen@oracle.com>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Better rpm database downgrade logic

Use the file command to see if the rpm database version needs to
be downgraded. Use the lsb_release command to determine the host
system, which is then used to set the commands needed to do the
conversion, and lets us move the rpm database to the correct location
if the host rpm doesn't put it where the guest expects it to be.

Signed-off-by: Dwight Engen <dwight.engen@oracle.com>
Always rebuild rpm database

Always rebuild the rpm database with the guest's rpm so there are no
db version mismatches when you boot the guest and run rpm or yum.

Signed-off-by: Dwight Engen <dwight.engen@oracle.com>
Fix removal of unneeded startup/shutdown scripts

Signed-off-by: Dwight Engen <dwight.engen@oracle.com>
Honor network type and link from lxc-create -f

Make the oracle template honor the lxc.network.type and
lxc.network.link configuration items if a "base" configuration file is
passed to lxc-create. If no configuration file is passed and the host
system is Oracle or Fedora, the template assumes a type of veth and
the default name created by libvirt.

Signed-off-by: Dwight Engen <dwight.engen@oracle.com>