diff options
author | Pavel Hrdina <phrdina@redhat.com> | 2017-09-06 10:17:43 +0200 |
---|---|---|
committer | Pavel Hrdina <phrdina@redhat.com> | 2017-09-09 10:11:42 +0200 |
commit | fe6c5067c0d1fea786bb5255043a19d25249b65b (patch) | |
tree | 6e6e6fbfe701286726744f24176c8e81ecb342b4 /virtinst/cli.py | |
parent | ccaef8c16a89ad4ca64b07fd5f6cc6e91de3a15e (diff) | |
download | virt-manager-fe6c5067c0d1fea786bb5255043a19d25249b65b.tar.gz |
graphics: introduce listens.{type|address|network} parameters
Using "listens.*" allows better configuration of listen elements for
graphics devices. Currently the only way how to configure a listen
type is to abuse "listen" parameter and there is no way how to configure
exact "network".
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Diffstat (limited to 'virtinst/cli.py')
-rw-r--r-- | virtinst/cli.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/virtinst/cli.py b/virtinst/cli.py index 2c8cbff4..56669030 100644 --- a/virtinst/cli.py +++ b/virtinst/cli.py @@ -2233,6 +2233,22 @@ class ParserGraphics(VirtCLIParser): else: inst.listen = val + def listens_find_inst_cb(self, inst, val, virtarg, can_edit): + graphics = inst + num = 0 + if re.search("\d+", virtarg.key): + num = int(re.search("\d+", virtarg.key).group()) + + if can_edit: + while len(graphics.listens) < (num + 1): + graphics.add_listen() + try: + return graphics.listens[num] + except IndexError: + if not can_edit: + return None + raise + def _parse(self, inst): if self.optstr == "none": self.guest.skip_default_graphics = True @@ -2261,6 +2277,12 @@ ParserGraphics.add_arg(None, "type", cb=ParserGraphics.set_type_cb) ParserGraphics.add_arg("port", "port") ParserGraphics.add_arg("tlsPort", "tlsport") ParserGraphics.add_arg("listen", "listen", cb=ParserGraphics.set_listen_cb) +ParserGraphics.add_arg("type", "listens[0-9]*.type", + find_inst_cb=ParserGraphics.listens_find_inst_cb) +ParserGraphics.add_arg("address", "listens[0-9]*.address", + find_inst_cb=ParserGraphics.listens_find_inst_cb) +ParserGraphics.add_arg("network", "listens[0-9]*.network", + find_inst_cb=ParserGraphics.listens_find_inst_cb) ParserGraphics.add_arg(None, "keymap", cb=ParserGraphics.set_keymap_cb) ParserGraphics.add_arg("passwd", "password") ParserGraphics.add_arg("passwdValidTo", "passwordvalidto") |