virt-install: EGD RNG devs need a host to connect to if backend_mode=bind

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
This commit is contained in:
Giuseppe Scrivano 2013-10-25 17:13:27 +02:00
parent 8248331d6c
commit a832d77559
3 changed files with 36 additions and 5 deletions

View File

@ -1288,6 +1288,21 @@ Specify the port of the Entropy Gathering Daemon to connect to.
Specify the type of the connection: B<tcp> or B<udp>.
=item B<backend_mode>
Specify the mode of the connection. It is either 'bind' (wait for
connections on HOST:PORT) or 'connect' (send output to HOST:PORT).
=item B<backend_connect_host>
Specify the remote host to connect to when the specified backend_type is B<udp>
and backend_mode is B<bind>.
=item B<backend_connect_service>
Specify the remote service to connect to when the specified backend_type is
B<udp> and backend_mode is B<bind>.
=back
An example invocation:

View File

@ -446,13 +446,18 @@ c.add_valid("--tpm passthrough,model=tpm-tis") # --tpm backend type with model
c.add_valid("--tpm passthrough,model=tpm-tis,path=/dev/tpm0") # --tpm backend type with model and device path
c.add_invalid("--tpm passthrough,model=foo") # Invalid model
c = vinst.add_category("tpm", "--noautoconsole --nodisks --pxe")
c = vinst.add_category("rng", "--noautoconsole --nodisks --pxe")
c.add_valid("--rng random,device=/dev/random") # random device backend
c.add_valid("--rng /dev/random") # random device backend, short form
c.add_invalid("--rng /FOO/BAR") # random device backend, short form, invalid device
c.add_valid("--rng egd,backend_host=127.0.0.1,backend_service=8000,backend_type=tcp") # egd backend
c.add_valid("--rng egd,backend_host=127.0.0.1,backend_service=8000,backend_type=tcp,backend_mode=bind") # egd backend, bind mode
c.add_invalid("--rng foo,backend_host=127.0.0.1,backend_service=8000,backend_mode=connect") # invalid type
c.add_invalid("--rng egd,backend_host=127.0.0.1,backend_service=8000,backend_type=udp,backend_mode=bind") # invalid only bind for udp
c.add_valid("--rng egd,backend_host=127.0.0.1,backend_service=8000,backend_type=tcp,backend_mode=bind") # egd backend, bind mode
c.add_valid("--rng egd,backend_host=127.0.0.1,backend_service=8000,backend_type=udp,backend_mode=bind,backend_connect_host=foo,backend_connect_service=708") # egd backend, udp mode bind, bind backend mode
c = vinst.add_category("xen", "--connect %(XENURI)s --noautoconsole")
c.add_compare("--disk %(EXISTIMG1)s --import", "xen-default") # Xen default

View File

@ -926,7 +926,7 @@ def add_device_options(devg):
devg.add_option("--rng", dest="rng", action="append",
help=_("Configure a guest RNG device. Ex:\n"
"--rng /dev/random\n"
"--rng type=egd,host=localhost,service=708"))
"--rng egd,backend_host=localhost,backend_service=708,backend_type=tcp"))
def add_gfx_option(devg):
@ -1694,10 +1694,21 @@ def parse_rng(guest, optstr, dev):
else:
set_param("type", "type")
set_param("backend_source_host", "backend_host")
set_param("backend_source_service", "backend_service")
set_param("backend_source_mode", "backend_mode")
set_param("backend_type", "backend_type")
backend_mode = opts.get("backend_mode", "connect")
if backend_mode == "connect":
set_param("connect_host", "backend_host")
set_param("connect_service", "backend_service")
if backend_mode == "bind":
set_param("bind_host", "backend_host")
set_param("bind_service", "backend_service")
if opts.get("backend_type", "udp"):
set_param("connect_host", "backend_connect_host")
set_param("connect_service", "backend_connect_service")
set_param("device", "device")
set_param("model", "model")
set_param("rate_bytes", "rate_bytes")