This patch adds method for adding virtual machines via pool wizard:
- Method queries user for pool_dir andlibvirt_domain, if valid ones are entered and
successfuly checked, it creates XML file containing hostname and libvirt_domain
needed for valid slave virtual machine config
Signed-off-by: Jiri Prochazka <jprochaz(a)redhat.com>
---
lnst/Controller/Wizard.py | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)
diff --git a/lnst/Controller/Wizard.py b/lnst/Controller/Wizard.py
index 20e5816..b9dabd5 100644
--- a/lnst/Controller/Wizard.py
+++ b/lnst/Controller/Wizard.py
@@ -137,6 +137,32 @@ class Wizard:
hostname=hostname, pool_dir=pool_dir,
filename=filename, mode="noninteractive")
+ def virtual(self, pool_dir=None):
+ """ Starts Wizard in a virtual mode
+ @param pool_dir Path to pool directory (optional)
+ """
+
+ print("WARNING: For LNST Pool Wizard to work with virtual guests,"\
+ "several conditions have to be met: \n"\
+ "\t1) Guests must be running under libvirt and QEMU\n"\
+ "\t2) Guests must be in \"default\" network and have an IP
"\
+ "address from DHCP in that network")
+
+ pool_dir = self._check_and_query_pool_dir(pool_dir)
+
+ while True:
+ hostname, libvirt_domain= self._query_libvirt_domain()
+ filename = self._query_filename(libvirt_domain)
+
+ self._create_xml(hostname=hostname, pool_dir=pool_dir,
+ filename=filename, mode="virtual",
+ libvirt_domain=libvirt_domain)
+
+ if self._query_continuation():
+ continue
+ else:
+ break
+
def _check_hostname(self, hostname):
""" Checks hostnames translatibility
@param hostname Hostname which is checked whether it's valid
--
2.4.3