From 9bd4af3785094c80e43b67de0fef071a9f4a6abd Mon Sep 17 00:00:00 2001 From: Jonatan Schlag Date: Thu, 19 Apr 2018 13:10:36 +0200 Subject: [PATCH] Add the login credentials to the vm() class Signed-off-by: Jonatan Schlag --- test.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/test.py b/test.py index 0460d17..8140aff 100755 --- a/test.py +++ b/test.py @@ -53,7 +53,7 @@ class libvirt_con(): class vm(): - def __init__(self, vm_xml_file, snapshot_xml_file, image, root_uid): + def __init__(self, vm_xml_file, snapshot_xml_file, image, root_uid, username, password): self.log = log(4) self.con = libvirt_con("qemu:///system") try: @@ -75,6 +75,9 @@ class vm(): self.root_uid = root_uid + self.username = username + self.password = password + def define(self): self.dom = self.con.con.defineXML(self.vm_xml) if self.dom == None: @@ -137,10 +140,10 @@ class vm(): #serial_con.close() - def login(self, username, password): + def login(self): try: - self.serial_con = connection(self.get_serial_device(), username="root") - self.serial_con.login("25814@root") + self.serial_con = connection(self.get_serial_device(), username=self.username) + self.serial_con.login(self.password) except BaseException as e: self.log.error("Could not connect to the domain via serial console") -- 2.39.2