util: fix tracevol.py to take config map namespace as an option

Added a new option so that user can specify the namespace for config map.

Signed-off-by: Mudit Agarwal <muagarwa@redhat.com>
This commit is contained in:
Mudit Agarwal 2020-07-28 20:05:19 +05:30 committed by mergify[bot]
parent b2c9c589aa
commit 3585b21e80

View File

@ -63,6 +63,8 @@ PARSER.add_argument("-key", "--userkey",
default="", help="user password to connect to ceph cluster") default="", help="user password to connect to ceph cluster")
PARSER.add_argument("-cm", "--configmap", default="ceph-csi-config", PARSER.add_argument("-cm", "--configmap", default="ceph-csi-config",
help="configmap name which holds the cephcsi configuration") help="configmap name which holds the cephcsi configuration")
PARSER.add_argument("-cmn", "--configmapnamespace", default="default",
help="namespace where configmap exists")
def list_pvc_vol_name_mapping(arg): def list_pvc_vol_name_mapping(arg):
@ -450,6 +452,7 @@ def get_subvol_group(arg):
else: else:
cmd += ["--kubeconfig", arg.kubeconfig] cmd += ["--kubeconfig", arg.kubeconfig]
cmd += ['get', 'cm', arg.configmap, '-o', 'json'] cmd += ['get', 'cm', arg.configmap, '-o', 'json']
cmd += ['--namespace', arg.configmapnamespace]
out = subprocess.Popen(cmd, stdout=subprocess.PIPE, out = subprocess.Popen(cmd, stdout=subprocess.PIPE,
stderr=subprocess.STDOUT) stderr=subprocess.STDOUT)
stdout, stderr = out.communicate() stdout, stderr = out.communicate()