Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package virt-scenario for openSUSE:Factory 
checked in at 2023-03-29 23:28:07
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/virt-scenario (Old)
 and      /work/SRC/openSUSE:Factory/.virt-scenario.new.31432 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "virt-scenario"

Wed Mar 29 23:28:07 2023 rev:9 rq:1075211 version:1.0.6

Changes:
--------
--- /work/SRC/openSUSE:Factory/virt-scenario/virt-scenario.changes      
2023-03-25 18:55:45.706791079 +0100
+++ /work/SRC/openSUSE:Factory/.virt-scenario.new.31432/virt-scenario.changes   
2023-03-29 23:28:08.723760119 +0200
@@ -1,0 +2,19 @@
+Wed Mar 29 12:18:45 UTC 2023 - Antoine Ginies <[email protected]>
+
+- version 1.0.6:
+   * fix (bsc#1209862): virt-scenario-launch can't stop or get status
+     on virtual machine
+   * fix wrong way to call print_error
+
+-------------------------------------------------------------------
+Wed Mar 29 09:37:45 UTC 2023 - Antoine Ginies <[email protected]>
+
+- version 1.0.5:
+  * force_sev now can be disabled (bsc#1209865)
+  * check /dev/tpm0 exist before using it (bsc#1209863)
+  * switch usage of print_title and print_summary
+  * simplify function show_how_to_use()
+  * avoid redefining bytes
+  * pylint fixes
+
+-------------------------------------------------------------------

Old:
----
  virt-scenario-1.0.4.tar.gz

New:
----
  virt-scenario-1.0.6.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ virt-scenario.spec ++++++
--- /var/tmp/diff_new_pack.JST2WH/_old  2023-03-29 23:28:09.263763004 +0200
+++ /var/tmp/diff_new_pack.JST2WH/_new  2023-03-29 23:28:09.267763026 +0200
@@ -19,7 +19,7 @@
 %define pythons python3
 
 Name:           virt-scenario
-Version:        1.0.4
+Version:        1.0.6
 Release:        0
 Summary:        Create XML guest configuration and prepare the host for a 
scenario
 License:        GPL-3.0-or-later

++++++ virt-scenario-1.0.4.tar.gz -> virt-scenario-1.0.6.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/virt-scenario-1.0.4/ChangeLog 
new/virt-scenario-1.0.6/ChangeLog
--- old/virt-scenario-1.0.4/ChangeLog   2023-03-24 15:03:48.000000000 +0100
+++ new/virt-scenario-1.0.6/ChangeLog   2023-03-29 14:17:50.000000000 +0200
@@ -1,3 +1,74 @@
+2023-03-29 aginies  <[email protected]>
+    
+    1.0.6
+    
+    
+2023-03-29 Antoine Giniès  <[email protected]>
+    
+    Merge pull request #11 from joergroedel/fixes
+    Fix virtscenario-launch with active domains and TPM not found exception
+    
+2023-03-29 Joerg Roedel  <[email protected]>
+    
+    virtscenario/hypervisor: Use also listAllDomains() in dominfo()
+    The listDefined() method does not list active domains, so additionally
+    search with listAllDomains() to find a match.
+    
+    
+    
+2023-03-29 Joerg Roedel  <[email protected]>
+    
+    virtscenario/util: Call print_error() directly
+    The call is already in module util, so calling it with the util prefix
+    causes an exception.
+    
+    
+    
+2023-03-29 aginies  <[email protected]>
+    
+    use util.print_error for TPM device
+    
+    
+2023-03-29 aginies  <[email protected]>
+    
+    sync with README.md
+    
+    
+2023-03-29 aginies  <[email protected]>
+    
+    pylint fixes
+    
+    
+2023-03-29 aginies  <[email protected]>
+    
+    avoid redefining bytes
+    
+    
+2023-03-29 aginies  <[email protected]>
+    
+    simplify function show_how_to_use()
+    
+    
+2023-03-29 aginies  <[email protected]>
+    
+    switch usage of print_title and print_summary
+    
+    
+2023-03-29 aginies  <[email protected]>
+    
+    prepare 1.0.5
+    
+    
+2023-03-29 aginies  <[email protected]>
+    
+    force_sev now can be disabled (bsc#1209865)
+    
+    
+2023-03-29 aginies  <[email protected]>
+    
+    check /dev/tpm0 exist before using it (bsc#1209863)
+    
+    
 2023-03-24 aginies  <[email protected]>
     
     vm-config-store: /etc/virts-scenario/vmconfig; 1.0.4
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/virt-scenario-1.0.4/PKG-INFO 
new/virt-scenario-1.0.6/PKG-INFO
--- old/virt-scenario-1.0.4/PKG-INFO    2023-03-24 15:03:48.000000000 +0100
+++ new/virt-scenario-1.0.6/PKG-INFO    2023-03-29 14:17:50.000000000 +0200
@@ -1,6 +1,6 @@
 Metadata-Version: 2.1
 Name: virt-scenario
-Version: 1.0.4
+Version: 1.0.6
 Summary: Virt-scenario
 Home-page: https://github.com/aginies/virt-scenario
 Author: Antoine Ginies
@@ -367,7 +367,7 @@
         
         # Example with securevm (Confidential Computing)
         
-        virt-scenario currently only support setting Virtual Machine on AMD 
SEV or SEV-ES system.
+        virt-scenario currently only support setting secure Virtual Machine on 
AMD SEV or SEV-ES system.
         For more information about SUSE and SEV please refer to [SLES AMD 
SEV](href="https://documentation.suse.com/sles/15-SP4/single-html/SLES-amd-sev/).
         
         ## Prepare  Your VM
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/virt-scenario-1.0.4/README.md 
new/virt-scenario-1.0.6/README.md
--- old/virt-scenario-1.0.4/README.md   2023-03-24 14:51:59.000000000 +0100
+++ new/virt-scenario-1.0.6/README.md   2023-03-29 11:35:14.000000000 +0200
@@ -359,7 +359,7 @@
 
 # Example with securevm (Confidential Computing)
 
-virt-scenario currently only support setting Virtual Machine on AMD SEV or 
SEV-ES system.
+virt-scenario currently only support setting secure Virtual Machine on AMD SEV 
or SEV-ES system.
 For more information about SUSE and SEV please refer to [SLES AMD 
SEV](href="https://documentation.suse.com/sles/15-SP4/single-html/SLES-amd-sev/).
 
 ## Prepare  Your VM
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/virt-scenario-1.0.4/man/virt-scenario.1 
new/virt-scenario-1.0.6/man/virt-scenario.1
--- old/virt-scenario-1.0.4/man/virt-scenario.1 2023-03-24 12:08:14.000000000 
+0100
+++ new/virt-scenario-1.0.6/man/virt-scenario.1 2023-03-29 11:36:59.000000000 
+0200
@@ -60,7 +60,7 @@
 # This will overwrite scenario settings....
 config:
   - path: /etc/virt-scenario
-  - vm-config-store: \[ti]/.local/virtscenario/
+  - vm-config-store: /etc/virts-scenario/vmconfig
 emulator:
   - emulator: /usr/bin/qemu-system-x86_64
 input:
@@ -790,8 +790,8 @@
 memballoon_data * rng_data * metadata_data * only support 1 disk per VM
 .SH Example with securevm (Confidential Computing)
 .PP
-virt-scenario currently only support setting Virtual Machine on AMD SEV
-or SEV-ES system.
+virt-scenario currently only support setting secure Virtual Machine on
+AMD SEV or SEV-ES system.
 For more information about SUSE and SEV please refer to SLES AMD SEV.
 .SS Prepare Your VM
 .PP
@@ -841,7 +841,7 @@
 .fi
 .PP
 The generated XML file is available in
-\f[B]\[ti]/.local/virtscenario/ALPOS/domain.xml\f[R].
+\f[B]\[ti]/etc/virt-scenario/vmconfig/ALPOS/domain.xml\f[R].
 You can also find a \f[B]config.yaml\f[R] which contains host data about
 this VM.
 In our case \f[B]attestation\f[R] will be set to true, the host will be
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/virt-scenario-1.0.4/setup.py 
new/virt-scenario-1.0.6/setup.py
--- old/virt-scenario-1.0.4/setup.py    2023-03-24 14:52:05.000000000 +0100
+++ new/virt-scenario-1.0.6/setup.py    2023-03-29 14:17:04.000000000 +0200
@@ -161,7 +161,7 @@
 
 setuptools.setup(
     name="virt-scenario",
-    version="1.0.4",
+    version="1.0.6",
     author="Antoine Ginies",
     author_email="[email protected]",
     description="Virt-scenario",
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/virt-scenario-1.0.4/src/virt_scenario.egg-info/PKG-INFO 
new/virt-scenario-1.0.6/src/virt_scenario.egg-info/PKG-INFO
--- old/virt-scenario-1.0.4/src/virt_scenario.egg-info/PKG-INFO 2023-03-24 
15:03:48.000000000 +0100
+++ new/virt-scenario-1.0.6/src/virt_scenario.egg-info/PKG-INFO 2023-03-29 
14:17:50.000000000 +0200
@@ -1,6 +1,6 @@
 Metadata-Version: 2.1
 Name: virt-scenario
-Version: 1.0.4
+Version: 1.0.6
 Summary: Virt-scenario
 Home-page: https://github.com/aginies/virt-scenario
 Author: Antoine Ginies
@@ -367,7 +367,7 @@
         
         # Example with securevm (Confidential Computing)
         
-        virt-scenario currently only support setting Virtual Machine on AMD 
SEV or SEV-ES system.
+        virt-scenario currently only support setting secure Virtual Machine on 
AMD SEV or SEV-ES system.
         For more information about SUSE and SEV please refer to [SLES AMD 
SEV](href="https://documentation.suse.com/sles/15-SP4/single-html/SLES-amd-sev/).
         
         ## Prepare  Your VM
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/virt-scenario-1.0.4/src/virtscenario/__init__.py 
new/virt-scenario-1.0.6/src/virtscenario/__init__.py
--- old/virt-scenario-1.0.4/src/virtscenario/__init__.py        2023-03-24 
14:51:03.000000000 +0100
+++ new/virt-scenario-1.0.6/src/virtscenario/__init__.py        2023-03-29 
14:17:21.000000000 +0200
@@ -30,4 +30,4 @@
 
     builtins.__dict__["_"] = str
 
-__version__ = "1.0.4"
+__version__ = "1.0.6"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/virt-scenario-1.0.4/src/virtscenario/host.py 
new/virt-scenario-1.0.6/src/virtscenario/host.py
--- old/virt-scenario-1.0.4/src/virtscenario/host.py    2023-03-23 
17:40:54.000000000 +0100
+++ new/virt-scenario-1.0.6/src/virtscenario/host.py    2023-03-29 
10:44:15.000000000 +0200
@@ -73,7 +73,7 @@
     """
     Create the storage image
     """
-    util.print_summary("\nCreating the Virtual Machine image")
+    util.print_title("\nCreating the Virtual Machine image")
     encryption = ""
     #ie: qemu-img create -f qcow2 Win2k.img 20G
     if os.path.isdir(storage_data['path']):
@@ -155,7 +155,7 @@
     """
     check that libvirt support sev
     """
-    util.print_summary("\nCheck libvirt support SEV")
+    util.print_title("\nCheck libvirt support SEV")
     if sev_info.supported() is True:
         util.print_ok("Libvirt support SEV")
     else:
@@ -210,7 +210,7 @@
         fdhp.write("vm.nr_hugepages"+num_hugepages)
         fdhp.close()
         out, errs = util.system_command("sysctl 
vm.nr_hugepages="+num_hugepages)
-        util.print_summary("\nSetting vm.nr_hugepages="+num_hugepages)
+        util.print_title("\nSetting vm.nr_hugepages="+num_hugepages)
         if errs:
             print(errs)
         print(out)
@@ -221,7 +221,7 @@
     """
     cmd = "modprobe -vr kvm_amd ; modprobe -v kvm_amd"
     out, errs = util.system_command(cmd)
-    util.print_summary("\nReprobe the KVM module")
+    util.print_title("\nReprobe the KVM module")
     print(cmd)
     if errs:
         print(errs)
@@ -231,7 +231,7 @@
     """
     manage ksm
     """
-    util.print_summary("\nManaging KSM")
+    util.print_title("\nManaging KSM")
     if os.path.isdir("/sys/kernel/mm/ksm"):
         if todo == "enable":
             action = "start"
@@ -270,7 +270,7 @@
     """
     swappiness
     """
-    util.print_summary("\nSwappiness")
+    util.print_title("\nSwappiness")
     #echo 35 > /proc/sys/vm/swappiness
     #/etc/systcl.conf
     #vm.swappiness = 35
@@ -297,7 +297,7 @@
     """
     manage ioscheduler
     """
-    util.print_summary("\nIO scheduler")
+    util.print_title("\nIO scheduler")
     listdisk = list_all_disk()
     cmdstart = "echo "+scheduler+" > /sys/block"
     cmdend = "/queue/scheduler"
@@ -313,7 +313,7 @@
     be sure kvm_amd sev is enable if not enable it
     https://documentation.suse.com/sles/15-SP1/html/SLES-amd-sev/index.html
     """
-    util.print_summary("Enabling sev if needed")
+    util.print_title("Enabling sev if needed")
     check_libvirt_sev(sev_info)
     flag = "sev"
     test_flag = check_cpu_flag(flag)
@@ -334,7 +334,7 @@
     """
     check transparent hugepages and enable it
     """
-    util.print_summary("Transparent HugePages")
+    util.print_title("Transparent HugePages")
     # Check if transparent hugepages are available
     with open('/sys/kernel/mm/transparent_hugepage/defrag', 'r') as fil:
         available = fil.read().strip()
@@ -359,7 +359,7 @@
     
https://documentation.suse.com/sles/15-SP4/single-html/SLES-virtualization-best-practices/#sec-vt-best-mem-huge-pages
     """
     #pdpe1gb pse
-    util.print_summary("\nManaging Huge Pages")
+    util.print_title("\nManaging Huge Pages")
     flaglist = ["pdpe1gb", "pse"]
     foundok = False
     for flag in flaglist:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/virt-scenario-1.0.4/src/virtscenario/hypervisors.py 
new/virt-scenario-1.0.6/src/virtscenario/hypervisors.py
--- old/virt-scenario-1.0.4/src/virtscenario/hypervisors.py     2023-03-21 
16:09:37.000000000 +0100
+++ new/virt-scenario-1.0.6/src/virtscenario/hypervisors.py     2023-03-29 
14:17:00.000000000 +0200
@@ -72,6 +72,9 @@
         for dom in self.conn.listDefinedDomains():
             if dom == name:
                 return self.conn.lookupByName(name)
+        for dom in self.conn.listAllDomains(0):
+            if dom.name() == name:
+                return dom
         return None
 
     def define_domain(self, xmlfile):
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/virt-scenario-1.0.4/src/virtscenario/main.py 
new/virt-scenario-1.0.6/src/virtscenario/main.py
--- old/virt-scenario-1.0.4/src/virtscenario/main.py    2023-03-24 
14:50:32.000000000 +0100
+++ new/virt-scenario-1.0.6/src/virtscenario/main.py    2023-03-29 
11:33:27.000000000 +0200
@@ -20,8 +20,8 @@
 
 from cmd import Cmd
 import os
-import yaml
 import subprocess
+import yaml
 import virtscenario.util as util
 import virtscenario.guest as guest
 import virtscenario.scenario as s
@@ -46,7 +46,7 @@
     """
     create the VM domain XML from all template input given
     """
-    util.print_summary("\nCreate The XML VM configuration")
+    util.print_title("\nCreate The XML VM configuration")
     print(finalfile)
     with open(finalfile, 'w') as file_h:
         file_h.write(xml_all)
@@ -56,7 +56,7 @@
     draft xml create step
     create the xml file
     """
-    util.print_summary("\nCreate the XML file")
+    util.print_title("\nCreate the XML file")
     # final XML creation
     # start the domain definition
     xml_all = ""
@@ -97,18 +97,18 @@
     validate the XML file
     """
     filename = cfg_store.get_domain_config_filename()
-    util.print_summary("Guest Section")
+    util.print_title("Guest Section")
     create_xml_config(filename, data)
     xmlutil.show_from_xml(filename)
     util.validate_xml(filename)
     cfg_store.store_config()
     util.print_summary_ok("Guest XML Configuration is done")
 
-def show_how_to_use(filename, vmname):
+def show_how_to_use(vmname):
     """
     show the virsh define command
     """
-    util.print_summary("How to use this on your system")
+    util.print_title("How to use this on your system")
     util.print_ok("Use the virt-scenario-launch tool:\n")
     print("virt-scenario-launch --start "+vmname+"\n")
 
@@ -527,7 +527,6 @@
                     util.print_error("Unknow Section: {}".format(item))
 
         hv.load_hypervisors(self.hvfile)
-        #return self
 
     def check_storage(self):
         """
@@ -706,6 +705,7 @@
 
             cfg_store = configstore.create_config_store(self, computation, 
hypervisor, self.overwrite)
             if cfg_store is None:
+                util.print_error("No config store found...")
                 return
 
             self.cpumode = guest.create_cpumode_pass(computation.cpumode)
@@ -740,7 +740,7 @@
             self.hugepages = ""
 
             if (self.mode != "guest" or self.mode == "both") and 
util.check_iam_root() is True:
-                util.print_summary("Host Section")
+                util.print_title("Host Section")
                 # Create the Virtual Disk image
                 if self.vmimage is None:
                     host.create_storage_image(self.STORAGE_DATA)
@@ -757,7 +757,7 @@
                 final_step_guest(cfg_store, self)
 
             util.to_report(self.toreport, self.conffile)
-            show_how_to_use(cfg_store.get_path()+"domain.xml", self.callsign)
+            show_how_to_use(self.callsign)
 
     def do_desktop(self, args):
         """
@@ -789,6 +789,7 @@
 
             cfg_store = configstore.create_config_store(self, desktop, 
hypervisor, self.overwrite)
             if cfg_store is None:
+                util.print_error("No config store found...")
                 return
 
             self.cpumode = guest.create_cpumode_pass(desktop.cpumode)
@@ -797,7 +798,10 @@
             self.network = guest.create_interface(desktop.network)
             self.audio = guest.create_audio(desktop.audio)
             self.usb = guest.create_usb(desktop.usb)
-            self.tpm = guest.create_tpm(desktop.tpm)
+            if util.check_tpm() is not False:
+                self.tpm = guest.create_tpm(desktop.tpm)
+            else:
+                self.tpm = ""
             self.features = guest.create_features(desktop.features)
             self.clock = guest.create_clock(desktop.clock)
             self.video = guest.create_video(desktop.video)
@@ -825,7 +829,7 @@
             self.hugepages = ""
 
             if (self.mode != "guest" or self.mode == "both") and 
util.check_iam_root() is True:
-                util.print_summary("Host Section")
+                util.print_title("Host Section")
                 # Create the Virtual Disk image
                 if self.vmimage is None:
                     host.create_storage_image(self.STORAGE_DATA)
@@ -842,7 +846,7 @@
                 final_step_guest(cfg_store, self)
 
             util.to_report(self.toreport, self.conffile)
-            show_how_to_use(cfg_store.get_path()+"domain.xml", self.callsign)
+            show_how_to_use(self.callsign)
 
     def do_securevm(self, args):
         """
@@ -885,13 +889,17 @@
 
             cfg_store = configstore.create_config_store(self, securevm, 
hypervisor, self.overwrite)
             if cfg_store is None:
+                util.print_error("No config store found...")
                 return
 
             self.cpumode = guest.create_cpumode_pass(securevm.cpumode)
             self.power = guest.create_power(securevm.power)
             self.ondef = guest.create_ondef(securevm.ondef)
             self.network = guest.create_interface(securevm.network)
-            self.tpm = guest.create_tpm(securevm.tpm)
+            if util.check_tpm() is not False:
+                self.tpm = guest.create_tpm(securevm.tpm)
+            else:
+                self.tpm = ""
             self.features = guest.create_features(securevm.features)
             self.clock = guest.create_clock(securevm.clock)
             #self.iothreads = guest.create_iothreads(securevm.iothreads)
@@ -932,12 +940,12 @@
             self.filename = self.callsign+".xml"
 
             if (self.mode != "guest" or self.mode == "both") and 
util.check_iam_root() is True:
-                util.print_summary("Host Section")
+                util.print_title("Host Section")
                 # Create the Virtual Disk image
                 if self.vmimage is None:
                     host.create_storage_image(self.STORAGE_DATA)
                 # Deal with SEV
-                util.print_summary("Prepare SEV attestation")
+                util.print_title("Prepare SEV attestation")
                 if sev_info.sev_supported is True:
                     host.kvm_amd_sev(sev_info)
 
@@ -980,14 +988,14 @@
                 final_step_guest(cfg_store, self)
 
             util.to_report(self.toreport, self.conffile)
-            show_how_to_use(cfg_store.get_path()+"domain.xml", self.callsign)
+            show_how_to_use(self.callsign)
 
     def do_name(self, args):
         """
         Define the Virtual Machine name
         """
         if args == "":
-            print("Please select a correct Virtual Machine name")
+            util.print_error("Please select a correct Virtual Machine name")
         else:
             name = {
                 'name': args,
@@ -1000,7 +1008,7 @@
         Define the machine type
         """
         if args not in qemulist.LIST_MACHINETYPE:
-            print("Please select a correct machine Type")
+            util.print_error("Please select a correct machine Type")
         else:
             machine = {
                 'machine': args,
@@ -1023,8 +1031,7 @@
         Set the VCPU for the VM definition
         """
         if args.isdigit() is False:
-            print("Please select a correct vcpu number")
-            print(args)
+            util.print_error("Please select a correct vcpu number")
         else:
             print(args)
             vcpu = {
@@ -1052,7 +1059,7 @@
         Select the boot device
         """
         if args not in qemulist.LIST_BOOTDEV:
-            print("Please select a correct boot devices")
+            util.print_error("Please select a correct boot devices")
         else:
             boot_dev = {
                 'boot_dev': args,
@@ -1109,7 +1116,7 @@
 
         net_list = hypervisor.network_list()
         if args not in net_list:
-            print("Please select a Virtual Network name from:")
+            util.print_error("Please select a Virtual Network name from:")
             print(net_list)
         else:
             config = {
@@ -1123,7 +1130,7 @@
         Set Memory size, should be in Gib
         """
         if args.isdigit() is False:
-            print("Please select a correct memory value (GiB)")
+            util.print_error("Please select a correct memory value (GiB)")
         else:
             memory = {
                 'memory': args,
@@ -1160,7 +1167,7 @@
         """
         mode = args
         if mode not in self.all_modes:
-            print("Dont know this mode: help mode")
+            util.print_error("Dont know this mode: help mode")
         else:
             self.mode = mode
 
@@ -1181,17 +1188,18 @@
         """
         force = args
         if force not in self.on_off_options:
-            print("on / off")
+            util.print_error("Available options are: on / off")
         else:
             if force == "on":
                 util.print_warning("This is NOT secure as the PDH should be 
stored in a secure place!")
                 self.force_sev = True
-                config = {
-                    'force_sev': force,
+            else:
+                self.force_sev = False
+            config = {
+                'force_sev': force,
                 }
-                self.dataprompt.update({'force_sev': config['force_sev']})
-                self.update_prompt()
-
+            self.dataprompt.update({'force_sev': config['force_sev']})
+            self.update_prompt()
 
     def do_overwrite(self, args):
         """
@@ -1199,7 +1207,7 @@
         """
         overwrite = args
         if overwrite not in self.on_off_options:
-            print("on / off")
+            util.print_error("Available options are: on / off")
         else:
             overwrite = args
             config = {'overwrite': overwrite,}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/virt-scenario-1.0.4/src/virtscenario/util.py 
new/virt-scenario-1.0.6/src/virtscenario/util.py
--- old/virt-scenario-1.0.4/src/virtscenario/util.py    2023-03-24 
14:36:08.000000000 +0100
+++ new/virt-scenario-1.0.6/src/virtscenario/util.py    2023-03-29 
14:17:00.000000000 +0200
@@ -101,14 +101,14 @@
     formated_text = esc('green')+text+esc('reset')
     print(formated_text)
 
-def print_title(text):
+def print_summary(text):
     """
     Print title with blue background
     """
     formated_text = "\n"+esc('bg_blue')+text+esc('reset')
     print(formated_text)
 
-def print_summary(text):
+def print_title(text):
     """
     Print summary with magenta background
     """
@@ -151,15 +151,15 @@
     mac_address = ':'.join(octets)
     return mac_address
 
-def bytes_to_gibibytes(bytes):
+def bytes_to_gibibytes(bbytes):
     """
     Convert bytes to gibibytes.
     """
-    if not isinstance(bytes, (int, float)) or bytes < 0:
+    if not isinstance(bbytes, (int, float)) or bbytes < 0:
         raise ValueError("It must be an int or a float.")
 
     BYTES_IN_GIBIBYTE = 1024 ** 3
-    gibibytes = bytes / BYTES_IN_GIBIBYTE
+    gibibytes = bbytes / BYTES_IN_GIBIBYTE
     return round(gibibytes, 2)
 
 def validate_yaml_file(file_path):
@@ -199,6 +199,16 @@
         return False
     return True
 
+def check_tpm():
+    """
+    check /dev/tpm0 exist
+    """
+    path_to_tpm = "/dev/tpm0"
+    if not os.path.exists(path_to_tpm):
+        print_error("No {} found".format(path_to_tpm))
+        return False
+    return True
+
 def update_virthost_cert_file(yaml_file_path, hypervisor, new_sev_cert_path):
     # Load the YAML file
     with open(yaml_file_path, 'r') as stream:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/virt-scenario-1.0.4/src/virtscenario_launch/main.py 
new/virt-scenario-1.0.6/src/virtscenario_launch/main.py
--- old/virt-scenario-1.0.4/src/virtscenario_launch/main.py     2023-03-22 
10:12:10.000000000 +0100
+++ new/virt-scenario-1.0.6/src/virtscenario_launch/main.py     2023-03-29 
14:16:58.000000000 +0200
@@ -174,7 +174,7 @@
         print("No such domain {}".format(name))
         return
 
-    state, reason = dom.state()
+    state, _ = dom.state()
     if state == libvirt.VIR_DOMAIN_NOSTATE:
         state_str = "No state"
     elif state == libvirt.VIR_DOMAIN_RUNNING:

Reply via email to