]> git.ipfire.org Git - nitsi.git/commitdiff
Add the login credentials to the vm() class
authorJonatan Schlag <jonatan.schlag@ipfire.org>
Thu, 19 Apr 2018 11:10:36 +0000 (13:10 +0200)
committerJonatan Schlag <jonatan.schlag@ipfire.org>
Thu, 19 Apr 2018 11:10:36 +0000 (13:10 +0200)
Signed-off-by: Jonatan Schlag <jonatan.schlag@ipfire.org>
test.py

diff --git a/test.py b/test.py
index 0460d17d7f4ba0ec6cfebc5b69383ec345e8885e..8140aff86933aebc90dcb84ca6df08419a98e6d8 100755 (executable)
--- 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")