mirror of
https://github.com/projectatomic/atomic.git
synced 2026-02-05 09:44:59 +01:00
add --lvsize option to atomic storage modify
Signed-off-by: Shishir Mahajan <shishir.mahajan@redhat.com> Closes: #900 Approved by: rhatdan
This commit is contained in:
committed by
Atomic Bot
parent
8fafc5feeb
commit
ab4e7cb0bb
@@ -66,6 +66,7 @@ def cli(subparser):
|
||||
modifyp.add_argument('--rootfs', dest="rootfs", default=None,
|
||||
help='Mountpath where logical volume for container storage would be mounted. e.g. /var/lib/containers')
|
||||
modifyp.add_argument('--lvname', dest="lvname", default=None, help='logical volume name for container storage. e.g container-root-lv')
|
||||
modifyp.add_argument('--lvsize', dest="lvsize", default=None, help='logical volume size for container storage.')
|
||||
modifyp.add_argument('--driver', dest="driver", default=None, help='The storage backend driver', choices=['devicemapper', 'overlay', 'overlay2'])
|
||||
modifyp.add_argument('--vgroup', dest="vgroup", default=None, help='The storage volume group')
|
||||
modifyp.add_argument("--graph", dest="graph",
|
||||
@@ -172,6 +173,13 @@ class Storage(Atomic):
|
||||
if self.args.driver:
|
||||
self._driver(self.args.driver)
|
||||
if self.args.rootfs and self.args.lvname:
|
||||
if self.args.lvsize:
|
||||
try:
|
||||
cmd = 'bash -c ". /usr/lib/docker-storage-setup/libdss.sh; check_data_size_syntax {0}"'.format(self.args.lvsize)
|
||||
util.check_call(cmd)
|
||||
except subprocess.CalledProcessError:
|
||||
raise ValueError("Invalid format for --lvsize")
|
||||
self._lvsize(self.args.lvsize)
|
||||
self._rootfs(self.args.rootfs)
|
||||
self._lvname(self.args.lvname)
|
||||
else:
|
||||
@@ -254,6 +262,9 @@ class Storage(Atomic):
|
||||
def _lvname(self, lvname):
|
||||
util.sh_modify_var_in_file(self.dss_conf, "CONTAINER_ROOT_LV_NAME",
|
||||
lambda old: lvname)
|
||||
def _lvsize(self, lvsize):
|
||||
util.sh_modify_var_in_file(self.dss_conf, "CONTAINER_ROOT_LV_SIZE",
|
||||
lambda old: lvsize)
|
||||
|
||||
def _vgroup(self, vgroup):
|
||||
util.sh_modify_var_in_file(self.dss_conf, "VG",
|
||||
|
||||
@@ -1289,6 +1289,7 @@ _atomic_storage_modify() {
|
||||
--add-device
|
||||
--rootfs
|
||||
--lvname
|
||||
--lvsize
|
||||
"
|
||||
local all_options="$options_with_args
|
||||
--help
|
||||
|
||||
@@ -98,6 +98,16 @@ E.g. --rootfs="/var/lib/containers". This will mount "container-root-lv"
|
||||
on "/var/lib/containers".
|
||||
Note: You must set --lvname when setting --rootfs.
|
||||
|
||||
**--lvsize**
|
||||
Logical volume size for container storage.
|
||||
E.g. --lvsize="20%FREE". It defaults to 40% of all free space.
|
||||
--lvsize can take values acceptable to "lvcreate -L" as well
|
||||
as some values acceptable to "lvcreate -l". If user intends to pass
|
||||
values acceptable to "lvcreate -l", then only those values which
|
||||
contains "%" in syntax are acceptable. If value does not contain
|
||||
"%" it is assumed value is suitable for "lvcreate -L".
|
||||
Note: You must set --lvname and --rootfs when setting --lvsize.
|
||||
|
||||
**--vgroup**
|
||||
The name of the volume group for the storage pool.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user