api_test.py revision e0de36d791e82d9916cad4ac41562077cf9789c3
#
# api_test.py: Test/demo of the python3-lxc API
#
# (C) Copyright Canonical Ltd. 2012
#
# Authors:
# Stéphane Graber <stgraber@ubuntu.com>
#
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This library 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
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
import warnings
import lxc
import uuid
import sys
# Some constants
LXC_PATH_LIB = "/var/lib/lxc"
LXC_TEMPLATE = "ubuntu"
# Let's pick a random name, avoiding clashes
## Instantiate the container instance
print("Getting instance for '%s'" % CONTAINER_NAME)
# A few basic checks of the current state
## Create a rootfs
print("Creating rootfs using '%s'" % LXC_TEMPLATE)
## Test the config
print("Testing the configuration")
# A few basic checks of the current state
## Test the networking
print("Testing the networking")
# A few basic checks of the current state
## Starting the container
print("Starting the container")
# A few basic checks of the current state
## Checking IP address
print("Getting the IP addresses")
# A few basic checks of the current state
## Freezing the container
print("Freezing the container")
# A few basic checks of the current state
## Unfreezing the container
print("Unfreezing the container")
# A few basic checks of the current state
## Attaching to tty1
print("Attaching to tty1")
## Shutting down the container
print("Shutting down the container")
print("Stopping the container")
# A few basic checks of the current state
## Cloning the container
print("Cloning the container")
## Destroy the container
print("Destroying the container")