From 6f6e1f51128a0e4bcbaf7e7cd7169d7644dabda2 Mon Sep 17 00:00:00 2001
From: Cole Robinson <crobinso@redhat.com>
Date: Wed, 9 Oct 2013 13:52:07 +0200
Subject: [RHEL-7.0 virt-manager PATCH] cli: rng devices accepts options also
when the short form is used
(cherry picked from commit 16a190a0dc319f7f912cde81d07a0170c5a9fdf2)
Conflicts:
virtinst/cli.py
---
virtinst/cli.py | 27 +++++++++++++--------------
1 file changed, 13 insertions(+), 14 deletions(-)
diff --git a/virtinst/cli.py b/virtinst/cli.py
index 99fcef0..c7488a3 100644
--- a/virtinst/cli.py
+++ b/virtinst/cli.py
@@ -1929,8 +1929,7 @@ def parse_rng(guest, optstring, dev=None):
return None
opts = parse_optstr(optstring, remove_first="type")
- dev_type = opts.get("type")
- if dev_type == "none":
+ if opts.get("type") == "none":
return None
if not dev:
@@ -1938,21 +1937,21 @@ def parse_rng(guest, optstring, dev=None):
set_param = _build_set_param(dev, opts)
- if dev_type.startswith("/"):
- # if the provided type begins with '/' then assume it is the name of
- # the RNG device and that its type is "random".
- dev.device = dev_type
+ # Allow --rng /dev/random
+ if opts.get("type", "").startswith("/"):
+ dev.device = opts.pop("type")
dev.type = "random"
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")
- set_param("device", "device")
- set_param("model", "model")
- set_param("rate_bytes", "rate_bytes")
- set_param("rate_period", "rate_period")
+
+ 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")
+ set_param("device", "device")
+ set_param("model", "model")
+ set_param("rate_bytes", "rate_bytes")
+ set_param("rate_period", "rate_period")
return dev
--
1.8.3.2