Commit 8a99c920 authored by Olaf Hering's avatar Olaf Hering Committed by Greg Kroah-Hartman

tools: hv: update lsvmbus to be compatible with python3

Python3 changed the way how 'print' works.
Adjust the code to a syntax that is understood by python2 and python3.
Signed-off-by: default avatarOlaf Hering <olaf@aepfle.de>
Acked-by: default avatarDexuan Cui <decui@microsoft.com>
Signed-off-by: default avatarK. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 619a4c8b
...@@ -17,7 +17,7 @@ if options.verbose is not None: ...@@ -17,7 +17,7 @@ if options.verbose is not None:
vmbus_sys_path = '/sys/bus/vmbus/devices' vmbus_sys_path = '/sys/bus/vmbus/devices'
if not os.path.isdir(vmbus_sys_path): if not os.path.isdir(vmbus_sys_path):
print "%s doesn't exist: exiting..." % vmbus_sys_path print("%s doesn't exist: exiting..." % vmbus_sys_path)
exit(-1) exit(-1)
vmbus_dev_dict = { vmbus_dev_dict = {
...@@ -93,11 +93,11 @@ format2 = '%2s: Class_ID = %s - %s\n\tDevice_ID = %s\n\tSysfs path: %s\n%s' ...@@ -93,11 +93,11 @@ format2 = '%2s: Class_ID = %s - %s\n\tDevice_ID = %s\n\tSysfs path: %s\n%s'
for d in vmbus_dev_list: for d in vmbus_dev_list:
if verbose == 0: if verbose == 0:
print ('VMBUS ID ' + format0) % (d.vmbus_id, d.dev_desc) print(('VMBUS ID ' + format0) % (d.vmbus_id, d.dev_desc))
elif verbose == 1: elif verbose == 1:
print ('VMBUS ID ' + format1) % \ print (('VMBUS ID ' + format1) % \
(d.vmbus_id, d.class_id, d.dev_desc, d.chn_vp_mapping) (d.vmbus_id, d.class_id, d.dev_desc, d.chn_vp_mapping))
else: else:
print ('VMBUS ID ' + format2) % \ print (('VMBUS ID ' + format2) % \
(d.vmbus_id, d.class_id, d.dev_desc, \ (d.vmbus_id, d.class_id, d.dev_desc, \
d.device_id, d.sysfs_path, d.chn_vp_mapping) d.device_id, d.sysfs_path, d.chn_vp_mapping))
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment