net.magik6k.jliblxc

LxcContainer

class LxcContainer extends AnyRef

LXC Container instance

Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. LxcContainer
  2. AnyRef
  3. Any
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Instance Constructors

  1. new LxcContainer(name: String)

  2. new LxcContainer(name: String, lxcPath: String = null)

    name

    Name to use for container.

    lxcPath

    Optional full path to configuration file to use, by default /var/lib/lxc

Value Members

  1. final def !=(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  2. final def !=(arg0: Any): Boolean

    Definition Classes
    Any
  3. final def ##(): Int

    Definition Classes
    AnyRef → Any
  4. final def ==(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  5. final def ==(arg0: Any): Boolean

    Definition Classes
    Any
  6. def addDeviceNode(srcPath: String, dstPath: String): Boolean

    Add specified device to the container.

    Add specified device to the container.

    srcPath

    Full path of the device.

    dstPath

    Alternate path in the container (or \p NULL to use src_path).

    returns

    true on success, else false.

  7. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  8. def attach(): Process

    This method is not implemented yet

  9. def attachInterface(ptr: Long, device: String, dstDevice: String): Boolean

    Add specified netdev to the container.

    Add specified netdev to the container.

    device

    name of the net device.

    dstDevice

    name of the other net device.

    returns

    true on success, else false.

    To do

    FIX THIS DOCS IN LIBLXC AND PUT HERE

  10. def attachRunWait(): Int

    This method is not implemented yet

  11. def checkpoint(directory: String, stop: Boolean, verbose: Boolean): Boolean

    Checkpoint a container.

    Checkpoint a container.

    directory

    The directory to dump the container to.

    stop

    Whether or not to stop the container after checkpointing.

    verbose

    Enable criu's verbose logs.

    returns

    true on success, else false.

  12. def clearConfig(): Unit

    Completely clear the containers in-memory configuration.

  13. def clearConfigItem(key: String): Boolean

    Clear a configuration item.

    Clear a configuration item.

    key

    Name of option to clear.

    returns

    true on success, else false.

  14. def clone(): AnyRef

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  15. def cloneContainer(newName: String, bDevType: String = null, flags: Int = 0, lxcPath: String = null, bDevData: String = null, newSize: Long = 0, hookArgs: Array[String] = null): NativeLxcContainer

    Copy a stopped container.

    Copy a stopped container.

    newName

    New name for the container. If NULL, the same name is used and a new lxcPath MUST be specified.

    bDevType

    Optionally force the cloned bdevtype to a specified plugin. By default the original is used (subject to snapshot requirements).

    flags

    Additional \c LXC_CLONE* flags to change the cloning behaviour:

    • LXC_CLONE_KEEPNAME
    • LXC_CLONE_KEEPMACADDR
    • LXC_CLONE_SNAPSHOT
    lxcPath

    lxcpath in which to create the new container. If NULL, the original container's lxcpath will be used.

    bDevData

    Information about how to create the new storage (i.e. fstype and fsdata).

    newSize

    In case of a block device backing store, an optional size. If \c 0, the original backing store's size will be used if possible. Note this only applies to the rootfs. For any other filesystems, the original size will be duplicated.

    hookArgs

    Additional arguments to pass to the clone hook script.

    returns

    Newly-allocated copy of container, or NULL on error.

  16. def configFileName: String

    Return current config file name.

    Return current config file name.

    returns

    config file name, or null on error.

  17. def console(): FileChannel

    This method is not implemented yet

  18. def create(template: String, bdType: String, bdSpecs: BdevSpecs = null, flags: Int = 0, args: Array[String] = null): Boolean

    Create a container.

    Create a container.

    template

    Template to execute to instantiate the root filesystem and adjust the configuration.

    bdType

    Backing store type to use (if \c NULL, \c dir will be used).

    bdSpecs

    Additional parameters for the backing store (for example LVM volume group to use).

    flags

    LXC_CREATE_* options (currently only \ref LXC_CREATE_QUIET is supported).

    args

    Arguments to pass to the template

    returns

    true on success, else false.

  19. def destroy(): Boolean

    Delete the container.

    Delete the container.

    returns

    true on success, else false.

    Note

    Container must be stopped and have no dependent snapshots.

  20. def destroyWithSnapshots(): Boolean

    Delete the container and all its snapshots.

    Delete the container and all its snapshots.

    returns

    true on success, else false.

    Note

    Container must be stopped.

  21. def detachInterface(ptr: Long, device: String, dstDevice: String): Boolean

    Remove specified device from the container.

    Remove specified device from the container.

    device

    name of the net device.

    dstDevice

    name of the other net device.

    returns

    true on success, else false.

    To do

    FIX THIS DOCS IN LIBLXC AND PUT HERE

  22. final def eq(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  23. def equals(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  24. def finalize(): Unit

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  25. def freeze(): Boolean

    Freeze running container.

    Freeze running container.

    returns

    true on success, else false.

  26. def getCgroupItem(subSystem: String): String

    Retrieve the specified cgroup subsystem value for the container.

    Retrieve the specified cgroup subsystem value for the container.

    subSystem

    cgroup subsystem to consider, like 'blkio.time'.

    returns

    subSystem value or null on error.

  27. final def getClass(): Class[_]

    Definition Classes
    AnyRef → Any
  28. def getConfigItem(key: String): String

    Retrieve the value of a config item.

    Retrieve the value of a config item.

    key

    Name of option to get.

    returns

    the item or null on error.

  29. def getConfigPath: String

    Determine full path to the containers configuration file.

    Determine full path to the containers configuration file.

    Each container can have a custom configuration path. However by default it will be set to either the LXCPATH configure variable, or the lxcpath value in the LXC_GLOBAL_CONF configuration file (i.e. /etc/lxc/lxc.conf). The value for a specific container can be changed using #setConfigPath. There is no other way to specify this in general at the moment.

    returns

    string representing full path to configuration file.

  30. def getInterfaces: Array[String]

    Obtain a list of network interfaces.

    Obtain a list of network interfaces.

    returns

    Array of network interfaces, or null on error.

  31. def getIps(interface: String, family: String, scope: Int): Array[String]

    Determine the list of container IP addresses.

    Determine the list of container IP addresses.

    interface

    Network interface name to consider.

    family

    Network family (for example "inet", "inet6").

    scope

    IPv6 scope id (ignored if family is not "inet6").

    returns

    Array of network interface addresses, or null on error.

  32. def getKeys(key: String): Array[String]

    Retrieve a list of config item keys given a key prefix.

    Retrieve a list of config item keys given a key prefix.

    key

    Name of option to get.

    returns

    List of items for a given key or null on error.

  33. def getLastError: String

    Returns last error.

    Returns last error.

    returns

    Last error that occurred.

  34. def getRunningConfigItem(key: String): String

    Retrieve the value of a config item from running container.

    Retrieve the value of a config item from running container.

    key

    Name of option to get.

    returns

    the item or null on error.

  35. def hashCode(): Int

    Definition Classes
    AnyRef → Any
  36. def initPid(): Int

    Determine process ID of the containers init process.

    Determine process ID of the containers init process.

    returns

    pid of init process as seen from outside the container.

  37. def isDefined: Boolean

    Determine if /var/lib/lxc/[name]/config exists.

    Determine if /var/lib/lxc/[name]/config exists.

    returns

    true if container is defined, else false.

  38. final def isInstanceOf[T0]: Boolean

    Definition Classes
    Any
  39. def isRunning: Boolean

    Determine if container is running.

    Determine if container is running.

    returns

    true if running, else false.

  40. def loadConfig(altFile: File = null): Boolean

    Load the specified configuration for the container.

    Load the specified configuration for the container.

    altFile

    Optional alternative configuration file.

    returns

    true on success, else false.

  41. def mayControl(): Boolean

    Determine if the caller may control the container.

    Determine if the caller may control the container.

    returns

    false if there is a control socket for the container monitor and the caller may not access it, otherwise returns true.

  42. final def ne(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  43. final def notify(): Unit

    Definition Classes
    AnyRef
  44. final def notifyAll(): Unit

    Definition Classes
    AnyRef
  45. def reboot(): Boolean

    Request the container reboot by sending it SIGINT.

    Request the container reboot by sending it SIGINT.

    returns

    true if reboot request successful, else false.

  46. def removeDeviceNode(srcPath: String, dstPath: String): Boolean

    Remove specified device from the container.

    Remove specified device from the container.

    srcPath

    Full path of the device.

    dstPath

    Alternate path in the container (or \p NULL to use src_path).

    returns

    true on success, else false.

  47. def rename(newName: String): Boolean

    Rename a container

    Rename a container

    newName

    New name to be used for the container.

    returns

    true on success, else false.

  48. def restore(directory: String, verbose: Boolean): Boolean

    Restore a container from a checkpoint.

    Restore a container from a checkpoint.

    directory

    The directory to dump the container to.

    verbose

    Enable criu's verbose logs.

    returns

    true on success, else false.

  49. def saveConfig(altFile: File = null): Boolean

    Save configuration to a file.

    Save configuration to a file.

    altFile

    Optional alternative configuration file.

    returns

    true on success, else false.

  50. def setCgroupItem(subSystem: String, value: String): Boolean

    Set the specified cgroup subsystem value for the container.

    Set the specified cgroup subsystem value for the container.

    subSystem

    cgroup subsystem to consider, like 'blkio.time'.

    value

    Value to set for subSystem.

    returns

    true on success, else false.

  51. def setConfigItem(key: String, value: String): Boolean

    Set a key/value configuration option.

    Set a key/value configuration option.

    key

    Name of option to set.

    value

    Value to be set.

    returns

    true on success, else false.

  52. def setConfigPath(path: File): Boolean

    Set the full path to the containers configuration file.

    Set the full path to the containers configuration file.

    path

    Path to configuration file.

    returns

    true on success, else false.

  53. def shutdown(timeout: Int = 5): Boolean

    Request the container shutdown by sending it SIGPWR.

    Request the container shutdown by sending it SIGPWR.

    timeout

    Seconds to wait before returning false. (-1 to wait forever, 0 to avoid waiting).

    returns

    true if the container was shutdown successfully, else false.

  54. def snapshot(commentFile: String = null): Int

    Create a container snapshot.

    Create a container snapshot.

    Assuming default paths, snapshots will be created as /var/lib/lxc/\<c\>/snaps/snap\ where \<c\> represents the container name and represents the zero-based snapshot number.

    commentFile

    Full path to file containing a description of the snapshot.

    returns

    -1 on error, or zero-based snapshot number.

    Note

    commentfile may be NULL but this is discouraged.

  55. def snapshotDestroy(snapName: String): Boolean

    Destroy the specified snapshot.

    Destroy the specified snapshot.

    snapName

    Name of snapshot.

    returns

    true on success, else false.

  56. def snapshotDestroyAll(): Boolean

    Destroy all the container's snapshot.

    Destroy all the container's snapshot.

    returns

    true on success, else false.

  57. def snapshotList(): Array[Snapshot]

    Obtain a list of container snapshots.

    Obtain a list of container snapshots.

    returns

    List of snapshots.

  58. def snapshotRestore(snapName: String, newName: String): Boolean

    Create a new container based on a snapshot.

    Create a new container based on a snapshot.

    The restored container will be a copy (not snapshot) of the snapshot, and restored in the lxcpath of the original container.

    snapName

    Name of snapshot.

    newName

    Name to be used for the restored snapshot.

    returns

    true on success, else false.

    Note

    As an example, if the container exists as /var/lib/lxc/c1, snapname might be 'snap0' (representing /var/lib/lxc/c1/snaps/snap0). If newname is c2, then snap0 will be copied to /var/lib/lxc/c2.

    ,

    If newname is the same as the current container name, the container will be destroyed. However, this will fail if the snapshot is overlay-based, since the snapshots will pin the original container.

  59. def start(args: String*): Boolean

    Start the container.

    Start the container.

    args

    Optional arguments to be passed to init.

    returns

    true on success, else false.

  60. def state(): ContainerState

    Determine state of container.

    Determine state of container.

    returns

    Static upper-case string representing state of container.

  61. def stop(): Boolean

    Stop the container.

    Stop the container.

    returns

    true on success, else false.

  62. final def synchronized[T0](arg0: ⇒ T0): T0

    Definition Classes
    AnyRef
  63. def toString(): String

    Definition Classes
    AnyRef → Any
  64. def unfreeze(): Boolean

    Thaw a frozen container.

    Thaw a frozen container.

    returns

    true on success, else false.

  65. final def wait(): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  66. final def wait(arg0: Long, arg1: Int): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  67. final def wait(arg0: Long): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  68. def waitForState(state: String, timeout: Int): Boolean

    Wait for container to reach a particular state.

    Wait for container to reach a particular state.

    state

    State to wait for.

    timeout

    Timeout in seconds.

    returns

    true if state reached within timeout, else false.

    Note

    A timeout of -1 means wait forever. A timeout of 0 means do not wait.

  69. def wantCloseAllFDs(state: Boolean): Boolean

    Determine whether container wishes all file descriptors to be closed on startup.

    Determine whether container wishes all file descriptors to be closed on startup.

    state

    Value for the close_all_fds bit (0 or 1).

    returns

    true if container wants all file descriptors closed, else \c false.

  70. def wantDaemonize(state: Boolean): Boolean

    Determine if the container wants to run disconnected from the terminal.

    Determine if the container wants to run disconnected from the terminal.

    state

    Value for the daemonize bit (0 or 1).

    returns

    true if container wants to be daemonised, else false.

Inherited from AnyRef

Inherited from Any

Ungrouped