Merge lp:~townsend/libertine/configure-freeze into lp:libertine

Proposed by Christopher Townsend
Status: Merged
Approved by: Larry Price
Approved revision: 386
Merged at revision: 386
Proposed branch: lp:~townsend/libertine/configure-freeze
Merge into: lp:libertine
Prerequisite: lp:~townsend/libertine/freeze-containers
Diff against target: 118 lines (+35/-8)
3 files modified
tools/completions/libertine-container-manager (+5/-4)
tools/libertine-container-manager (+22/-1)
tools/libertine-container-manager.1 (+8/-3)
To merge this branch: bzr merge lp:~townsend/libertine/configure-freeze
Reviewer Review Type Date Requested Status
Larry Price Approve
Libertine CI Bot continuous-integration Approve
Review via email: mp+315488@code.launchpad.net

Commit message

Add ability to enable and disable the freezing of LXC/LXD containers when not in use.

Description of the change

The second in the series of MP's to allow freezing and unfreezing of LXC/LXD containers.

To post a comment you must log in.
Revision history for this message
Libertine CI Bot (libertine-ci-bot) wrote :

PASSED: Continuous integration, rev:385
https://jenkins.canonical.com/libertine/job/lp-libertine-ci/342/
Executed test runs:
    SUCCESS: https://jenkins.canonical.com/libertine/job/build/671
    SUCCESS: https://jenkins.canonical.com/libertine/job/test-0-autopkgtest/label=amd64,release=xenial+overlay,testname=default/551
    SUCCESS: https://jenkins.canonical.com/libertine/job/test-0-autopkgtest/label=amd64,release=zesty,testname=default/551
    SUCCESS: https://jenkins.canonical.com/libertine/job/test-0-autopkgtest/label=i386,release=xenial+overlay,testname=default/551
    SUCCESS: https://jenkins.canonical.com/libertine/job/test-0-autopkgtest/label=i386,release=zesty,testname=default/551
    SUCCESS: https://jenkins.canonical.com/libertine/job/build-0-fetch/681
    SUCCESS: https://jenkins.canonical.com/libertine/job/build-2-binpkg/arch=amd64,release=xenial+overlay/662
        deb: https://jenkins.canonical.com/libertine/job/build-2-binpkg/arch=amd64,release=xenial+overlay/662/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/libertine/job/build-2-binpkg/arch=amd64,release=zesty/662
        deb: https://jenkins.canonical.com/libertine/job/build-2-binpkg/arch=amd64,release=zesty/662/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/libertine/job/build-2-binpkg/arch=i386,release=xenial+overlay/662
        deb: https://jenkins.canonical.com/libertine/job/build-2-binpkg/arch=i386,release=xenial+overlay/662/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/libertine/job/build-2-binpkg/arch=i386,release=zesty/662
        deb: https://jenkins.canonical.com/libertine/job/build-2-binpkg/arch=i386,release=zesty/662/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://jenkins.canonical.com/libertine/job/lp-libertine-ci/342/rebuild

review: Approve (continuous-integration)
Revision history for this message
Larry Price (larryprice) wrote :

one inline

review: Needs Information
386. By Christopher Townsend

Merge in prerequisite branch.

Revision history for this message
Libertine CI Bot (libertine-ci-bot) wrote :

PASSED: Continuous integration, rev:386
https://jenkins.canonical.com/libertine/job/lp-libertine-ci/348/
Executed test runs:
    SUCCESS: https://jenkins.canonical.com/libertine/job/build/677
    SUCCESS: https://jenkins.canonical.com/libertine/job/test-0-autopkgtest/label=amd64,release=xenial+overlay,testname=default/554
    SUCCESS: https://jenkins.canonical.com/libertine/job/test-0-autopkgtest/label=amd64,release=zesty,testname=default/554
    SUCCESS: https://jenkins.canonical.com/libertine/job/test-0-autopkgtest/label=i386,release=xenial+overlay,testname=default/554
    SUCCESS: https://jenkins.canonical.com/libertine/job/test-0-autopkgtest/label=i386,release=zesty,testname=default/554
    SUCCESS: https://jenkins.canonical.com/libertine/job/build-0-fetch/687
    SUCCESS: https://jenkins.canonical.com/libertine/job/build-2-binpkg/arch=amd64,release=xenial+overlay/668
        deb: https://jenkins.canonical.com/libertine/job/build-2-binpkg/arch=amd64,release=xenial+overlay/668/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/libertine/job/build-2-binpkg/arch=amd64,release=zesty/668
        deb: https://jenkins.canonical.com/libertine/job/build-2-binpkg/arch=amd64,release=zesty/668/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/libertine/job/build-2-binpkg/arch=i386,release=xenial+overlay/668
        deb: https://jenkins.canonical.com/libertine/job/build-2-binpkg/arch=i386,release=xenial+overlay/668/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/libertine/job/build-2-binpkg/arch=i386,release=zesty/668
        deb: https://jenkins.canonical.com/libertine/job/build-2-binpkg/arch=i386,release=zesty/668/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://jenkins.canonical.com/libertine/job/lp-libertine-ci/348/rebuild

review: Approve (continuous-integration)
Revision history for this message
Christopher Townsend (townsend) wrote :

Commented on your comment:)

Revision history for this message
Larry Price (larryprice) wrote :

lgtm

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'tools/completions/libertine-container-manager'
2--- tools/completions/libertine-container-manager 2016-10-14 14:44:17 +0000
3+++ tools/completions/libertine-container-manager 2017-01-24 20:57:04 +0000
4@@ -1,5 +1,6 @@
5-# Copyright (C) 2016 Canonical Ltd.
6-# Author: Larry Price <larry.price@canonical.com>
7+# Copyright (C) 2016-2017 Canonical Ltd.
8+# Authors: Larry Price <larry.price@canonical.com>
9+# Chris Townsend <christopher.townsend@canonical.com>
10
11 # This program is free software: you can redistribute it and/or modify
12 # it under the terms of the GNU General Public License as published by
13@@ -48,7 +49,7 @@
14 opts="--help"
15 ;;
16 "configure" )
17- opts="--help --id --multiarch --archive --bind-mount"
18+ opts="--help --id --multiarch --archive --bind-mount --freeze"
19 ;;
20 "set-default" )
21 opts="--help --id --clear"
22@@ -60,7 +61,7 @@
23 fi
24
25 if [[ ${cmd} == "configure" ]]; then
26- if [[ "${COMP_WORDS[COMP_CWORD-1]}" == "--multiarch" ]]; then
27+ if [[ "${COMP_WORDS[COMP_CWORD-1]}" == "--multiarch" ]] || [ "${COMP_WORDS[COMP_CWORD-1]}" == "--freeze" ]; then
28 opts="enable disable"
29 elif [ "${COMP_WORDS[COMP_CWORD-1]}" == "--archive" ] || [ "${COMP_WORDS[COMP_CWORD-1]}" == "--bind-mount" ]; then
30 opts="add remove"
31
32=== modified file 'tools/libertine-container-manager'
33--- tools/libertine-container-manager 2017-01-18 15:19:23 +0000
34+++ tools/libertine-container-manager 2017-01-24 20:57:04 +0000
35@@ -1,7 +1,7 @@
36 #!/usr/bin/python3
37 # -*- coding: utf-8 -*-
38
39-# Copyright (C) 2014-2016 Canonical Ltd.
40+# Copyright (C) 2014-2017 Canonical Ltd.
41 # Author: Christopher Townsend <christopher.townsend@canonical.com>
42
43 # This program is free software: you can redistribute it and/or modify
44@@ -328,6 +328,19 @@
45 sys.exit(1)
46 self.containers_config.delete_bind_mount(container_id, mount_path)
47
48+ elif args.freeze is not None:
49+ container_type = self.containers_config.get_container_type(container_id)
50+
51+ if container_type != 'lxc' and container_type != 'lxd':
52+ libertine.utils.get_logger().error("Configuring freeze is only valid on LXC and LXD container types.")
53+ sys.exit(1)
54+
55+ current_freeze = self.containers_config.get_freeze_on_stop(container_id)
56+ config_freeze = args.freeze == 'enable'
57+
58+ if current_freeze != config_freeze:
59+ self.containers_config.update_freeze_on_stop(container_id, config_freeze)
60+
61 else:
62 libertine.utils.get_logger().error("Configure called with no subcommand. See configure --help for usage.")
63 sys.exit(1)
64@@ -552,6 +565,14 @@
65 metavar='Mount path',
66 help=("The absolute host path to bind-mount."))
67
68+ freeze_group = parser_configure.add_argument_group("Freeze container support",
69+ "Enable or disable freezing LXC/LXD containers when not in use.")
70+ freeze_group.add_argument(
71+ '-f', '--freeze',
72+ choices=['enable', 'disable'],
73+ help=("Enables or disables freezing of LXC/LXD containers when not in use."
74+ " When disabled, the container will stop."))
75+
76 parser_configure.set_defaults(func=container_manager.configure)
77
78 # Handle merging another ContainersConfig.json file into the main ContainersConfig.json file
79
80=== modified file 'tools/libertine-container-manager.1'
81--- tools/libertine-container-manager.1 2017-01-12 20:46:05 +0000
82+++ tools/libertine-container-manager.1 2017-01-24 20:57:04 +0000
83@@ -1,4 +1,4 @@
84-.TH libertine-container-manager "1" " April 2016" "libertine-container-manager 0.99" "User Commands"
85+.TH libertine-container-manager "1" " January 2017" "libertine-container-manager 1.5.1" "User Commands"
86
87 .SH NAME
88 libertine-container-manager \- Manage Libertine containers for supporting legacy X applications on Unity 8
89@@ -275,7 +275,7 @@
90 Enable i386 support.
91 .RE
92 .IP
93-.BR \-a " {add,remove}, " \-\-archive "{add,remove}" ""
94+.BR \-a " {add,remove}, " \-\-archive " {add,remove}" ""
95 .RS 14
96 Adds or removes an archive in the specified container.
97 .RE
98@@ -290,7 +290,7 @@
99 File containing public key used to sign new archive.
100 .RE
101 .IP
102-.BR \-b " {add,remove}, " \-\-bind-mount "{add,remove}" ""
103+.BR \-b " {add,remove}, " \-\-bind-mount " {add,remove}" ""
104 .RS 14
105 Adds or removes a bind-mount in the specified container.
106 .RE
107@@ -299,6 +299,11 @@
108 .RS 14
109 Absolute host path to be added or removed.
110 .RE
111+.IP
112+.BR \-f " {enable,disable}, " \-\-freeze " {enable,disable}" ""
113+.RS 14
114+Enable or disable freezing LXC/LXD containers when not in use.
115+.RE
116 .TP
117
118 .B libertine-container-manager set-default [options]

Subscribers

People subscribed via source and target branches