From: Jonatan Schlag Date: Thu, 19 Apr 2018 11:10:36 +0000 (+0200) Subject: Add the login credentials to the vm() class X-Git-Url: http://git.ipfire.org/?p=nitsi.git;a=commitdiff_plain;h=9bd4af3785094c80e43b67de0fef071a9f4a6abd;ds=sidebyside Add the login credentials to the vm() class Signed-off-by: Jonatan Schlag --- 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")