packages feed

bindings-lxc 0.2 → 0.2.0.1

raw patch · 7 files changed

+251/−3 lines, 7 files

Files

CHANGELOG.md view
@@ -1,3 +1,8 @@+0.2.0.1+---+* better documentation+* no changes in the interface+ 0.2 --- * fixed types in `Bindings.LXC.Container`
README.md view
@@ -4,3 +4,55 @@ [![Build Status](https://travis-ci.org/fizruk/bindings-lxc.svg?branch=master)](https://travis-ci.org/fizruk/bindings-lxc)  Direct Haskell bindings to LXC (Linux containers) C API.++The package provides direct bindings to LXC C API through @bindings-dsl@.++For high-level Haskell LXC API see [lxc package](http://hackage.haskell.org/package/lxc).++## Requirements++Before installation make sure you have LXC installed on your system with header files and static library.++On Ubuntu 14.04 LTS (Trusty Tahr):++```+$ sudo apt-get install lxc-dev+```++On previous Ubuntu versions (including 12.04 LTS Precise Pangolin) standard repositories do not contain `liblxc1` package.+You might want to use `ppa:ubuntu-lxc/stable` repository instead:++```+$ sudo apt-get install software-properties-common python-software-properties+$ sudo add-apt-repository ppa:ubuntu-lxc/stable+$ sudo apt-get update+$ sudo apt-get install lxc-dev+```++## Installation++Get the latest stable version from Hackage:++```+$ cabal install bindings-lxc+```++or clone this repository:++```+$ git clone https://github.com/fizruk/bindings-lxc.git+$ cd bindings-lxc+$ cabal install+```++## Documentation++Haddock documentation is available at http://fizruk.github.io/bindings-lxc/docs/++## Contributing++Contributions and bug reports are welcome!++Please feel free to contact me via GitHub or on the #haskell IRC channel on irc.freenode.net.++-Nickolay Kudasov
bindings-lxc.cabal view
@@ -1,7 +1,9 @@ name:                bindings-lxc-version:             0.2+version:             0.2.0.1 synopsis:            Direct Haskell bindings to LXC (Linux containers) C API. description:         The package provides direct bindings to LXC C API through @bindings-dsl@.++                     For high-level Haskell LXC API see <http://hackage.haskell.org/package/lxc lxc package>. homepage:            https://github.com/fizruk/bindings-lxc bug-reports:         https://github.com/fizruk/bindings-lxc/issues license:             BSD3
src/Bindings/LXC.hs view
@@ -1,3 +1,15 @@+-----------------------------------------------------------------------------+-- |+-- Module      :  Bindings.LXC+-- Copyright   :  (c) Nickolay Kudasov 2014+-- License     :  BSD-style (see the file LICENSE)+--+-- Maintainer  :  nickolay.kudasov@gmail.com+--+-- Create, control and manage LXC containers.+-- You can get more info about LXC at <https://help.ubuntu.com/lts/serverguide/lxc.html> and <https://linuxcontainers.org>.+--+----------------------------------------------------------------------------- module Bindings.LXC (   module Bindings.LXC.Container,   module Bindings.LXC.AttachOptions,
src/Bindings/LXC/AttachOptions.hsc view
@@ -1,7 +1,56 @@ #include <bindings.dsl.h> #include <lxc/attach_options.h> -module Bindings.LXC.AttachOptions where+-----------------------------------------------------------------------------+-- |+-- Module      :  Bindings.LXC.AttachOptions+-- Copyright   :  (c) Nickolay Kudasov 2014+-- License     :  BSD-style (see the file LICENSE)+--+-- Maintainer  :  nickolay.kudasov@gmail.com+--+-- Options and structures to run commands inside LXC containers.+-- You can get more info about LXC at <https://help.ubuntu.com/lts/serverguide/lxc.html> and <https://linuxcontainers.org>.+--+-----------------------------------------------------------------------------+module Bindings.LXC.AttachOptions (+  -- * Attach env policy+  c'LXC_ATTACH_KEEP_ENV,+  c'LXC_ATTACH_CLEAR_ENV,+  -- * Attach flags+  c'LXC_ATTACH_MOVE_TO_CGROUP,+  c'LXC_ATTACH_DROP_CAPABILITIES,+  c'LXC_ATTACH_SET_PERSONALITY,+  c'LXC_ATTACH_LSM_EXEC,+  c'LXC_ATTACH_REMOUNT_PROC_SYS,+  c'LXC_ATTACH_LSM_NOW,+  c'LXC_ATTACH_DEFAULT,+  c'LXC_ATTACH_LSM,+  -- * Attach options+  C'lxc_attach_options_t(..),+  p'lxc_attach_options_t'attach_flags,+  p'lxc_attach_options_t'namespaces,+  p'lxc_attach_options_t'personality,+  p'lxc_attach_options_t'initial_cwd,+  p'lxc_attach_options_t'uid,+  p'lxc_attach_options_t'gid,+  p'lxc_attach_options_t'env_policy,+  p'lxc_attach_options_t'extra_env_vars,+  p'lxc_attach_options_t'extra_keep_env,+  p'lxc_attach_options_t'stdin_fd,+  p'lxc_attach_options_t'stdout_fd,+  p'lxc_attach_options_t'stderr_fd,+  -- * Attach command+  C'lxc_attach_command_t(..),+  p'lxc_attach_command_t'program,+  p'lxc_attach_command_t'argv,+  -- * Attach @exec@ functions+  C_lxc_attach_exec_t(..),+  c'lxc_attach_run_command,+  p'lxc_attach_run_command,+  c'lxc_attach_run_shell,+  p'lxc_attach_run_shell,+) where #strict_import import Bindings.LXC.Sys.Types 
src/Bindings/LXC/Container.hsc view
@@ -2,7 +2,124 @@ #include <lxc/lxccontainer.h> #include "bindings.lxc.container.h" -module Bindings.LXC.Container where+-----------------------------------------------------------------------------+-- |+-- Module      :  Bindings.LXC.Container+-- Copyright   :  (c) Nickolay Kudasov 2014+-- License     :  BSD-style (see the file LICENSE)+--+-- Maintainer  :  nickolay.kudasov@gmail.com+--+-- This module provides a set of functions to create, control and manage LXC containers.+-- You can get more info about LXC at <https://help.ubuntu.com/lts/serverguide/lxc.html> and <https://linuxcontainers.org>.+--+-----------------------------------------------------------------------------+module Bindings.LXC.Container (+  -- * Flags+  -- ** Clone flags+  c'LXC_CLONE_KEEPNAME,+  c'LXC_CLONE_KEEPMACADDR,+  c'LXC_CLONE_SNAPSHOT,+  c'LXC_CLONE_KEEPBDEVTYPE,+  c'LXC_CLONE_MAYBE_SNAPSHOT,+  c'LXC_CLONE_MAXFLAGS,+  -- ** Create flags+  c'LXC_CREATE_QUIET,+  c'LXC_CREATE_MAXFLAGS,+  -- * Data types and fields+  -- ** Container+  C'lxc_container(..),+  p'lxc_container'error_string,+  p'lxc_container'error_num,+  p'lxc_container'daemonize,+  p'lxc_container'config_path,+  -- ** Snapshot+  C'lxc_snapshot(..),+  p'lxc_snapshot'name,+  p'lxc_snapshot'comment_pathname,+  p'lxc_snapshot'timestamp,+  p'lxc_snapshot'lxcpath,+  p'lxc_snapshot'free,+  -- ** Back store device specs+  C'bdev_specs(..),+  p'bdev_specs'fstype,+  p'bdev_specs'fssize,+  p'bdev_specs'zfs,+  p'bdev_specs'lvm,+  p'bdev_specs'dir,+  C'zfs_t(..),+  p'zfs_t'zfsroot,+  C'lvm_t(..),+  p'lvm_t'vg,+  p'lvm_t'lv,+  p'lvm_t'thinpool,+  -- * Container methods+  -- ** Query container state+  p'lxc_container'is_defined,+  p'lxc_container'is_running,+  p'lxc_container'state,+  p'lxc_container'init_pid,+  p'lxc_container'get_interfaces,+  p'lxc_container'get_ips,+  -- ** Container config+  p'lxc_container'config_file_name,+  p'lxc_container'get_config_path,+  p'lxc_container'set_config_path,+  p'lxc_container'load_config,+  p'lxc_container'save_config,+  p'lxc_container'get_keys,+  p'lxc_container'set_config_item,+  p'lxc_container'get_config_item,+  p'lxc_container'get_running_config_item,+  p'lxc_container'clear_config,+  p'lxc_container'clear_config_item,+  -- ** Control container state+  p'lxc_container'start,+  p'lxc_container'stop,+  p'lxc_container'reboot,+  p'lxc_container'shutdown,+  p'lxc_container'freeze,+  p'lxc_container'unfreeze,+  p'lxc_container'wait,+  -- ** Manage containers+  p'lxc_container'create,+  p'lxc_container'clone,+  p'lxc_container'rename,+  p'lxc_container'destroy,+  -- ** Console+  p'lxc_container'console_getfd,+  p'lxc_container'console,+  -- ** Attach+  p'lxc_container'attach,+  p'lxc_container'attach_run_wait,+  -- ** Snapshots+  p'lxc_container'snapshot,+  p'lxc_container'snapshot_list,+  p'lxc_container'snapshot_restore,+  p'lxc_container'snapshot_destroy,+  -- ** Misc+  p'lxc_container'want_daemonize,+  p'lxc_container'want_close_all_fds,+  p'lxc_container'get_cgroup_item,+  p'lxc_container'set_cgroup_item,+  p'lxc_container'may_control,+  p'lxc_container'add_device_node,+  p'lxc_container'remove_device_node,+  -- * Global LXC functions+  -- ** Allocate and manage containers+  c'lxc_container_new,+  c'lxc_container_get,+  c'lxc_container_put,+  -- ** List containers+  c'list_defined_containers,+  c'list_active_containers,+  c'list_all_containers,+  -- ** Misc+  c'lxc_get_wait_states,+  c'lxc_get_global_config_item,+  c'lxc_get_version,+  c'lxc_log_close,+) where #strict_import import Bindings.LXC.Sys.Types import Bindings.LXC.AttachOptions
src/Bindings/LXC/Sys/Types.hsc view
@@ -2,6 +2,17 @@ #include <stdlib.h> #include <stdint.h> +-----------------------------------------------------------------------------+-- |+-- Module      :  Bindings.LXC.Sys.Types+-- Copyright   :  (c) Nickolay Kudasov 2014+-- License     :  BSD-style (see the file LICENSE)+--+-- Maintainer  :  nickolay.kudasov@gmail.com+--+-- System types from standard C library.+--+----------------------------------------------------------------------------- module Bindings.LXC.Sys.Types where #strict_import