Skip to contentSkip to conversation

scripts/qmp/qom-fuse: Scrape off the bitrot

PATCH In review Markus Armbruster 4 participants 15 messages Jul 23, 2020 – Jul 27, 2020

lore
Share & tools
lore
#0 lore raw

cover scripts/qmp/qom-fuse: Scrape off the bitrot

Markus Armbruster (3):
scripts/qmp/qom-fuse: Unbreak import of QEMUMonitorProtocol scripts/qmp/qom-fuse: Port to current Python module fuse scripts/qmp/qom-fuse: Fix getattr(), read() for files in /

 scripts/qmp/qom-fuse | 107 +++++++++++++++++++++++--------------------
 1 file changed, 57 insertions(+), 50 deletions(-)
Signature · 1 line
2.26.2
#1 lore raw

PATCH 1/3 scripts/qmp/qom-fuse: Unbreak import of QEMUMonitorProtocol

Commit c7b942d7f8 "scripts/qmp: Fix shebang and imports" messed with it for reasons I don't quite understand. I do understand how it fails
now: it neglects to import sys. Fix that.

It now fails because it expects an old version of module fuse. That's next.

Fixes c7b942d7f84ef54f266921bf7668d43f1f2c7c79
---
 scripts/qmp/qom-fuse | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
scripts/qmp/qom-fuse +2 -2
index 5fa6b3bf64..b7dabe8d65 100755
@@ -13,7 +13,7 @@
 
 import fuse, stat
 from fuse import Fuse
-import os, posix
+import os, posix, sys
 from errno import *
 
 sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', 'python'))
@@ -134,7 +134,7 @@ class QOMFS(Fuse):
             yield fuse.Direntry(str(item['name']))
 
 if __name__ == '__main__':
-    import sys, os
+    import os
 
     fs = QOMFS(QEMUMonitorProtocol(os.environ['QMP_SOCKET']))
     fs.main(sys.argv)
Signature · 1 line
2.26.2
Reviewed-by on v1 1/3
#2 lore raw

Re: [PATCH 1/3] scripts/qmp/qom-fuse: Unbreak import of QEMUMonitorProtocol

Quoted 3 lines · Markus Armbruster

Commit c7b942d7f8 "scripts/qmp: Fix shebang and imports" messed with it for reasons I don't quite understand. I do understand how it fails
now: it neglects to import sys. Fix that.

Oops I missed that.

Quoted 33 lines

It now fails because it expects an old version of module fuse. That's next.

Fixes c7b942d7f84ef54f266921bf7668d43f1f2c7c79
---
 scripts/qmp/qom-fuse | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
scripts/qmp/qom-fuse +2 -2
index 5fa6b3bf64..b7dabe8d65 100755
@@ -13,7 +13,7 @@
 
 import fuse, stat
 from fuse import Fuse
-import os, posix
+import os, posix, sys
 from errno import *
 
 sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', 'python'))
@@ -134,7 +134,7 @@ class QOMFS(Fuse):
             yield fuse.Direntry(str(item['name']))
 
 if __name__ == '__main__':
-    import sys, os
+    import os
 
     fs = QOMFS(QEMUMonitorProtocol(os.environ['QMP_SOCKET']))
     fs.main(sys.argv)
Reviewed-by on v1 1/3
#3 lore raw

Re: [PATCH 1/3] scripts/qmp/qom-fuse: Unbreak import of QEMUMonitorProtocol

In reply to Markus Armbruster
Quoted 4 lines · Markus Armbruster

Commit c7b942d7f8 "scripts/qmp: Fix shebang and imports" messed with it for reasons I don't quite understand. I do understand how it fails
now: it neglects to import sys. Fix that.

Apologies. These scripts didn't appear to work because they don't have any clue where the script they are trying to import lives. I was working on a series that refactored ./python/qemu into a python package.

The back half of that series hasn't landed upstream yet, so the import refuddling looks an awful lot more arbitrary at the moment, but the idea is that the scripts SHOULD work without needing to explicitly set your PYTHONPATH. For the moment, I think that's better.

My ultimate end-game is to get most python scripts under ./python/ and checked with pylint/mypy etc. as it will help detect breaking changes if library routines change. I want to institute a tree-wide regime for python code management that has a unified vision about how imports work and so on.

I would hope that this would reduce confusion in the future about how to execute scripts, how to write import statements, etc.

Most of what I am doing is baby steps towards that.

Quoted 3 lines

It now fails because it expects an old version of module fuse. That's next.

See also my commit message: "There's more wrong with these scripts; ..."

Quoted 2 lines
Fixes c7b942d7f84ef54f266921bf7668d43f1f2c7c79

Thanks:

Quoted 27 lines
---
  scripts/qmp/qom-fuse | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
scripts/qmp/qom-fuse +2 -2
index 5fa6b3bf64..b7dabe8d65 100755
@@ -13,7 +13,7 @@
 
  import fuse, stat
  from fuse import Fuse
-import os, posix
+import os, posix, sys
  from errno import *
 
  sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', 'python'))
@@ -134,7 +134,7 @@ class QOMFS(Fuse):
              yield fuse.Direntry(str(item['name']))
 
  if __name__ == '__main__':
-    import sys, os
+    import os
 
      fs = QOMFS(QEMUMonitorProtocol(os.environ['QMP_SOCKET']))
      fs.main(sys.argv)
#4 lore raw

PATCH 2/3 scripts/qmp/qom-fuse: Port to current Python module fuse

In reply to Markus Armbruster
---
 scripts/qmp/qom-fuse | 93 ++++++++++++++++++++++----------------------
 1 file changed, 47 insertions(+), 46 deletions(-)
scripts/qmp/qom-fuse +47 -46
index b7dabe8d65..405e6ebd67 100755
@@ -3,16 +3,18 @@
 # QEMU Object Model test tools
 #
 # Copyright IBM, Corp. 2012
+# Copyright (C) 2020 Red Hat, Inc.
 #
 # Authors:
 #  Anthony Liguori   <[email protected]>
+#  Markus Armbruster <[email protected]>
 #
 # This work is licensed under the terms of the GNU GPL, version 2 or later.  See
 # the COPYING file in the top-level directory.
 ##
 
 import fuse, stat
-from fuse import Fuse
+from fuse import FUSE, FuseOSError, Operations
 import os, posix, sys
 from errno import *
 
@@ -21,9 +23,8 @@ from qemu.qmp import QEMUMonitorProtocol
 
 fuse.fuse_python_api = (0, 2)
 
-class QOMFS(Fuse):
-    def __init__(self, qmp, *args, **kwds):
-        Fuse.__init__(self, *args, **kwds)
+class QOMFS(Operations):
+    def __init__(self, qmp):
         self.qmp = qmp
         self.qmp.connect()
         self.ino_map = {}
@@ -65,21 +66,21 @@ class QOMFS(Fuse):
         except:
             return False
 
-    def read(self, path, length, offset):
+    def read(self, path, length, offset, fh):
         if not self.is_property(path):
             return -ENOENT
 
         path, prop = path.rsplit('/', 1)
         try:
-            data = str(self.qmp.command('qom-get', path=path, property=prop))
+            data = self.qmp.command('qom-get', path=path, property=prop)
             data += '\n' # make values shell friendly
         except:
-            return -EPERM
+            raise FuseOSError(EPERM)
 
         if offset > len(data):
             return ''
 
-        return str(data[offset:][:length])
+        return bytes(data[offset:][:length], encoding='utf-8')
 
     def readlink(self, path):
         if not self.is_link(path):
@@ -89,52 +90,52 @@ class QOMFS(Fuse):
         return prefix + str(self.qmp.command('qom-get', path=path,
                                              property=prop))
 
-    def getattr(self, path):
+    def getattr(self, path, fh=None):
         if self.is_link(path):
-            value = posix.stat_result((0o755 | stat.S_IFLNK,
-                                       self.get_ino(path),
-                                       0,
-                                       2,
-                                       1000,
-                                       1000,
-                                       4096,
-                                       0,
-                                       0,
-                                       0))
+            value = { 'st_mode': 0o755 | stat.S_IFLNK,
+                      'st_ino': self.get_ino(path),
+                      'st_dev': 0,
+                      'st_nlink': 2,
+                      'st_uid': 1000,
+                      'st_gid': 1000,
+                      'st_size': 4096,
+                      'st_atime': 0,
+                      'st_mtime': 0,
+                      'st_ctime': 0 }
         elif self.is_object(path):
-            value = posix.stat_result((0o755 | stat.S_IFDIR,
-                                       self.get_ino(path),
-                                       0,
-                                       2,
-                                       1000,
-                                       1000,
-                                       4096,
-                                       0,
-                                       0,
-                                       0))
+            value = { 'st_mode': 0o755 | stat.S_IFDIR,
+                      'st_ino': self.get_ino(path),
+                      'st_dev': 0,
+                      'st_nlink': 2,
+                      'st_uid': 1000,
+                      'st_gid': 1000,
+                      'st_size': 4096,
+                      'st_atime': 0,
+                      'st_mtime': 0,
+                      'st_ctime': 0 }
         elif self.is_property(path):
-            value = posix.stat_result((0o644 | stat.S_IFREG,
-                                       self.get_ino(path),
-                                       0,
-                                       1,
-                                       1000,
-                                       1000,
-                                       4096,
-                                       0,
-                                       0,
-                                       0))
+            value = { 'st_mode': 0o644 | stat.S_IFREG,
+                      'st_ino': self.get_ino(path),
+                      'st_dev': 0,
+                      'st_nlink': 1,
+                      'st_uid': 1000,
+                      'st_gid': 1000,
+                      'st_size': 4096,
+                      'st_atime': 0,
+                      'st_mtime': 0,
+                      'st_ctime': 0 }
         else:
-            value = -ENOENT
+            raise FuseOSError(ENOENT)
         return value
 
-    def readdir(self, path, offset):
-        yield fuse.Direntry('.')
-        yield fuse.Direntry('..')
+    def readdir(self, path, fh):
+        yield '.'
+        yield '..'
         for item in self.qmp.command('qom-list', path=path):
-            yield fuse.Direntry(str(item['name']))
+            yield str(item['name'])
 
 if __name__ == '__main__':
     import os
 
-    fs = QOMFS(QEMUMonitorProtocol(os.environ['QMP_SOCKET']))
-    fs.main(sys.argv)
+    fuse = FUSE(QOMFS(QEMUMonitorProtocol(os.environ['QMP_SOCKET'])),
+                sys.argv[1], foreground=True)
Signature · 1 line
2.26.2
Reviewed-by on v1 2/3
#5 lore raw

Re: [PATCH 2/3] scripts/qmp/qom-fuse: Port to current Python module fuse

Quoted 1 line · Markus Armbruster

Honestly, benefit of the doubt on this one. The Python looks fine, but I don't know much about the FUSE module. Still, it was broken before, so if you claim it now works for you, that's more useful than it used to be.

Quoted 158 lines
---
  scripts/qmp/qom-fuse | 93 ++++++++++++++++++++++----------------------
  1 file changed, 47 insertions(+), 46 deletions(-)
scripts/qmp/qom-fuse +47 -46
index b7dabe8d65..405e6ebd67 100755
@@ -3,16 +3,18 @@
  # QEMU Object Model test tools
  #
  # Copyright IBM, Corp. 2012
+# Copyright (C) 2020 Red Hat, Inc.
  #
  # Authors:
  #  Anthony Liguori   <[email protected]>
+#  Markus Armbruster <[email protected]>
  #
  # This work is licensed under the terms of the GNU GPL, version 2 or later.  See
  # the COPYING file in the top-level directory.
  ##
 
  import fuse, stat
-from fuse import Fuse
+from fuse import FUSE, FuseOSError, Operations
  import os, posix, sys
  from errno import *
 
@@ -21,9 +23,8 @@ from qemu.qmp import QEMUMonitorProtocol
 
  fuse.fuse_python_api = (0, 2)
 
-class QOMFS(Fuse):
-    def __init__(self, qmp, *args, **kwds):
-        Fuse.__init__(self, *args, **kwds)
+class QOMFS(Operations):
+    def __init__(self, qmp):
          self.qmp = qmp
          self.qmp.connect()
          self.ino_map = {}
@@ -65,21 +66,21 @@ class QOMFS(Fuse):
          except:
              return False
 
-    def read(self, path, length, offset):
+    def read(self, path, length, offset, fh):
          if not self.is_property(path):
              return -ENOENT
 
          path, prop = path.rsplit('/', 1)
          try:
-            data = str(self.qmp.command('qom-get', path=path, property=prop))
+            data = self.qmp.command('qom-get', path=path, property=prop)
              data += '\n' # make values shell friendly
          except:
-            return -EPERM
+            raise FuseOSError(EPERM)
 
          if offset > len(data):
              return ''
 
-        return str(data[offset:][:length])
+        return bytes(data[offset:][:length], encoding='utf-8')
 
      def readlink(self, path):
          if not self.is_link(path):
@@ -89,52 +90,52 @@ class QOMFS(Fuse):
          return prefix + str(self.qmp.command('qom-get', path=path,
                                               property=prop))
 
-    def getattr(self, path):
+    def getattr(self, path, fh=None):
          if self.is_link(path):
-            value = posix.stat_result((0o755 | stat.S_IFLNK,
-                                       self.get_ino(path),
-                                       0,
-                                       2,
-                                       1000,
-                                       1000,
-                                       4096,
-                                       0,
-                                       0,
-                                       0))
+            value = { 'st_mode': 0o755 | stat.S_IFLNK,
+                      'st_ino': self.get_ino(path),
+                      'st_dev': 0,
+                      'st_nlink': 2,
+                      'st_uid': 1000,
+                      'st_gid': 1000,
+                      'st_size': 4096,
+                      'st_atime': 0,
+                      'st_mtime': 0,
+                      'st_ctime': 0 }
          elif self.is_object(path):
-            value = posix.stat_result((0o755 | stat.S_IFDIR,
-                                       self.get_ino(path),
-                                       0,
-                                       2,
-                                       1000,
-                                       1000,
-                                       4096,
-                                       0,
-                                       0,
-                                       0))
+            value = { 'st_mode': 0o755 | stat.S_IFDIR,
+                      'st_ino': self.get_ino(path),
+                      'st_dev': 0,
+                      'st_nlink': 2,
+                      'st_uid': 1000,
+                      'st_gid': 1000,
+                      'st_size': 4096,
+                      'st_atime': 0,
+                      'st_mtime': 0,
+                      'st_ctime': 0 }
          elif self.is_property(path):
-            value = posix.stat_result((0o644 | stat.S_IFREG,
-                                       self.get_ino(path),
-                                       0,
-                                       1,
-                                       1000,
-                                       1000,
-                                       4096,
-                                       0,
-                                       0,
-                                       0))
+            value = { 'st_mode': 0o644 | stat.S_IFREG,
+                      'st_ino': self.get_ino(path),
+                      'st_dev': 0,
+                      'st_nlink': 1,
+                      'st_uid': 1000,
+                      'st_gid': 1000,
+                      'st_size': 4096,
+                      'st_atime': 0,
+                      'st_mtime': 0,
+                      'st_ctime': 0 }
          else:
-            value = -ENOENT
+            raise FuseOSError(ENOENT)
          return value
 
-    def readdir(self, path, offset):
-        yield fuse.Direntry('.')
-        yield fuse.Direntry('..')
+    def readdir(self, path, fh):
+        yield '.'
+        yield '..'
          for item in self.qmp.command('qom-list', path=path):
-            yield fuse.Direntry(str(item['name']))
+            yield str(item['name'])
 
  if __name__ == '__main__':
      import os
 
-    fs = QOMFS(QEMUMonitorProtocol(os.environ['QMP_SOCKET']))
-    fs.main(sys.argv)
+    fuse = FUSE(QOMFS(QEMUMonitorProtocol(os.environ['QMP_SOCKET'])),
+                sys.argv[1], foreground=True)
#6 lore raw

Re: [PATCH 2/3] scripts/qmp/qom-fuse: Port to current Python module fuse

Quoted 5 lines · John Snow
Quoted 1 line · Markus Armbruster

Honestly, benefit of the doubt on this one. The Python looks fine, but I don't know much about the FUSE module.

All I knew when I started this job was that the script had worked for me before with some Fedora Python fuse package, and didn't work with Fedora 32's python3-fusepy.

Quoted 5 lines

Still, it was broken before,
so if you claim it now works for you, that's more useful than it used to be.

Thanks!

#7 lore raw

PATCH 3/3 scripts/qmp/qom-fuse: Fix getattr(), read() for files in /

In reply to Markus Armbruster

path, prop = "type".rsplit('/', 1) sets path to "", which doesn't work. Correct to "/".

---
 scripts/qmp/qom-fuse | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
scripts/qmp/qom-fuse +8 -2
index 405e6ebd67..7c7cff8edf 100755
@@ -45,8 +45,10 @@ class QOMFS(Operations):
             return False
 
     def is_property(self, path):
+        path, prop = path.rsplit('/', 1)
+        if path == '':
+            path = '/'
         try:
-            path, prop = path.rsplit('/', 1)
             for item in self.qmp.command('qom-list', path=path):
                 if item['name'] == prop:
                     return True
@@ -55,8 +57,10 @@ class QOMFS(Operations):
             return False
 
     def is_link(self, path):
+        path, prop = path.rsplit('/', 1)
+        if path == '':
+            path = '/'
         try:
-            path, prop = path.rsplit('/', 1)
             for item in self.qmp.command('qom-list', path=path):
                 if item['name'] == prop:
                     if item['type'].startswith('link<'):
@@ -71,6 +75,8 @@ class QOMFS(Operations):
             return -ENOENT
 
         path, prop = path.rsplit('/', 1)
+        if path == '':
+            path = '/'
         try:
             data = self.qmp.command('qom-get', path=path, property=prop)
             data += '\n' # make values shell friendly
Signature · 1 line
2.26.2
Reviewed-by on v1 3/3
#8 lore raw

Re: [PATCH 3/3] scripts/qmp/qom-fuse: Fix getattr(), read() for files in /

Quoted 13 lines · Markus Armbruster

path, prop = "type".rsplit('/', 1) sets path to "", which doesn't work. Correct to "/".

---
 scripts/qmp/qom-fuse | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
scripts/qmp/qom-fuse +0 -0
index 405e6ebd67..7c7cff8edf 100755

scripts/qmp/qom-fuse class QOMFS(Operations): · line 49

Quoted 8 lines
scripts/qmp/qom-fuse +3 -1
@@ -45,8 +45,10 @@ class QOMFS(Operations):
             return False
 
     def is_property(self, path):
+        path, prop = path.rsplit('/', 1)
+        if path == '':
+            path = '/'
         try:
-            path, prop = path.rsplit('/', 1)

Maybe worth adding an tiny root_path_split() helper?

Quoted 25 lines
scripts/qmp/qom-fuse +5 -1
             for item in self.qmp.command('qom-list', path=path):
                 if item['name'] == prop:
                     return True
@@ -55,8 +57,10 @@ class QOMFS(Operations):
             return False
 
     def is_link(self, path):
+        path, prop = path.rsplit('/', 1)
+        if path == '':
+            path = '/'
         try:
-            path, prop = path.rsplit('/', 1)
             for item in self.qmp.command('qom-list', path=path):
                 if item['name'] == prop:
                     if item['type'].startswith('link<'):
@@ -71,6 +75,8 @@ class QOMFS(Operations):
             return -ENOENT
 
         path, prop = path.rsplit('/', 1)
+        if path == '':
+            path = '/'
         try:
             data = self.qmp.command('qom-get', path=path, property=prop)
             data += '\n' # make values shell friendly
#9 lore raw

Re: [PATCH 3/3] scripts/qmp/qom-fuse: Fix getattr(), read() for files in /

Quoted 16 lines · Philippe Mathieu-Daudé
Quoted 15 lines · Markus Armbruster

path, prop = "type".rsplit('/', 1) sets path to "", which doesn't work. Correct to "/".

---
 scripts/qmp/qom-fuse | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
scripts/qmp/qom-fuse +0 -0
index 405e6ebd67..7c7cff8edf 100755
@@ -45,8 +45,10 @@ class QOMFS(Operations):
             return False
 
Quoted 8 lines

scripts/qmp/qom-fuse class QOMFS(Operations): · line 49

Quoted 6 lines
scripts/qmp/qom-fuse +3 -1
     def is_property(self, path):
+        path, prop = path.rsplit('/', 1)
+        if path == '':
+            path = '/'
         try:
-            path, prop = path.rsplit('/', 1)

Maybe worth adding an tiny root_path_split() helper?

The script goes back to commit 5ade767485 "qom: quick and dirty QOM filesystem based on FUSE" (2014). It's as "quick and dirty" as ever. It could use a thorough rework.

Quoted 1 line

Thanks!

[...]

Reviewed-by on v1 3/3
#10 lore raw

Re: [PATCH 3/3] scripts/qmp/qom-fuse: Fix getattr(), read() for files in /

In reply to Markus Armbruster
Quoted 3 lines · Markus Armbruster

path, prop = "type".rsplit('/', 1) sets path to "", which doesn't work. Correct to "/".

BOTD. If it works for you, that's good news.

Quoted 43 lines
---
  scripts/qmp/qom-fuse | 10 ++++++++--
  1 file changed, 8 insertions(+), 2 deletions(-)
scripts/qmp/qom-fuse +8 -2
index 405e6ebd67..7c7cff8edf 100755
@@ -45,8 +45,10 @@ class QOMFS(Operations):
              return False
 
      def is_property(self, path):
+        path, prop = path.rsplit('/', 1)
+        if path == '':
+            path = '/'
          try:
-            path, prop = path.rsplit('/', 1)
              for item in self.qmp.command('qom-list', path=path):
                  if item['name'] == prop:
                      return True
@@ -55,8 +57,10 @@ class QOMFS(Operations):
              return False
 
      def is_link(self, path):
+        path, prop = path.rsplit('/', 1)
+        if path == '':
+            path = '/'
          try:
-            path, prop = path.rsplit('/', 1)
              for item in self.qmp.command('qom-list', path=path):
                  if item['name'] == prop:
                      if item['type'].startswith('link<'):
@@ -71,6 +75,8 @@ class QOMFS(Operations):
              return -ENOENT
 
          path, prop = path.rsplit('/', 1)
+        if path == '':
+            path = '/'
          try:
              data = self.qmp.command('qom-get', path=path, property=prop)
              data += '\n' # make values shell friendly
#11 lore raw
In reply to Markus Armbruster
Quoted 4 lines · Markus Armbruster

Markus Armbruster (3):
scripts/qmp/qom-fuse: Unbreak import of QEMUMonitorProtocol scripts/qmp/qom-fuse: Port to current Python module fuse scripts/qmp/qom-fuse: Fix getattr(), read() for files in /

Could it be added to a CI pipeline, so that it does not bitrot again?

Thomas

#12 lore raw

Status of scripts/qmp/ (was: [PATCH 0/3] scripts/qmp/qom-fuse: Scrape off the bitrot)

Quoted 7 lines · Thomas Huth
Quoted 4 lines · Markus Armbruster

Markus Armbruster (3):
scripts/qmp/qom-fuse: Unbreak import of QEMUMonitorProtocol scripts/qmp/qom-fuse: Port to current Python module fuse scripts/qmp/qom-fuse: Fix getattr(), read() for files in /

Could it be added to a CI pipeline, so that it does not bitrot again?

Should it be?

Thread hijack!

What's the status of scripts/qmp/?

The directory is covered by MAINTAINERS section QMP, with status "Supported". Status is a *lie* for these scripts. I inherited them with the rest of QMP. I have no use for them, except I occasionally use qom-fuse for QOM spelunking, mostly because our monitor commands are so unwieldy compared to a filesystem. I barely looked at them in the 5+ years of my service as QMP maintainer. Actual status is "Odd fixes".

Does this stuff have any business in /scripts/?

Nothing in scripts/qmp/ should be shipped.

scripts/qmp/qemu-ga-client doesn't even belong there. Michael, is it of any use today?

I know scripts/qmp/qmp-shell has a few friends among developers. I regard it as a failed attempt at making QMP easier for humans, and have zero interest in it.

scripts/qmp/qmp looks like an attempt at making QMP easier for shell scripts. I'm not aware of actual use, and have zero interest in it.

scripts/qmp/qom-{get,list,set} look like an attempt at making QOM easier for shell scripts. I'm not aware of actual use, and have zero interest in it. Heck, I can't even figure out how to use qom-get (I just spend at least 30s trying).

scripts/qmp/qom-tree feels redundant with scripts/qmp/qom-fuse. I just ran it for the first time just to come to this judgement.

I believe contrib/ would be a better home for all of them.

I feel like moving the directory there and leaving it *uncovered* in MAINTAINERS. If a volunteer steps forward, we can add a suitable section.

Opinions?

#13 lore raw

Re: Status of scripts/qmp/ (was: [PATCH 0/3] scripts/qmp/qom-fuse: Scrape off the bitrot)

Quoted 34 lines · Markus Armbruster
Quoted 7 lines · Thomas Huth
Quoted 4 lines · Markus Armbruster

Markus Armbruster (3):
scripts/qmp/qom-fuse: Unbreak import of QEMUMonitorProtocol scripts/qmp/qom-fuse: Port to current Python module fuse scripts/qmp/qom-fuse: Fix getattr(), read() for files in /

Could it be added to a CI pipeline, so that it does not bitrot again?

Should it be?

Thread hijack!

What's the status of scripts/qmp/?

The directory is covered by MAINTAINERS section QMP, with status "Supported". Status is a *lie* for these scripts. I inherited them with the rest of QMP. I have no use for them, except I occasionally use qom-fuse for QOM spelunking, mostly because our monitor commands are so unwieldy compared to a filesystem. I barely looked at them in the 5+ years of my service as QMP maintainer. Actual status is "Odd fixes".

Does this stuff have any business in /scripts/?

Nothing in scripts/qmp/ should be shipped.

scripts/qmp/qemu-ga-client doesn't even belong there. Michael, is it of any use today?

I know scripts/qmp/qmp-shell has a few friends among developers. I regard it as a failed attempt at making QMP easier for humans, and have zero interest in it.

Quoted 7 lines

scripts/qmp/qmp looks like an attempt at making QMP easier for shell scripts. I'm not aware of actual use, and have zero interest in it.

scripts/qmp/qom-{get,list,set} look like an attempt at making QOM easier for shell scripts. I'm not aware of actual use, and have zero interest in it. Heck, I can't even figure out how to use qom-get (I just spend at least 30s trying).

According to the original commit (235fe3bfd46b1104575b540d0bc), it seems like these were using for manual testing. If in all those years nobody ever tried to integrate them into our "make check" test suite, I guess they are just dead code.

Quoted 10 lines

scripts/qmp/qom-tree feels redundant with scripts/qmp/qom-fuse. I just ran it for the first time just to come to this judgement.

I believe contrib/ would be a better home for all of them.

I feel like moving the directory there and leaving it *uncovered* in MAINTAINERS. If a volunteer steps forward, we can add a suitable section.

Opinions?

I'd suggest to remove the "test tools" from commit 235fe3bfd46b1104575b5 since apparently nobody ever cared to integrate them into the test suite.

For the other scripts that are still used occasionally, I'd leave them in their current location. If you don't want to maintain them, remove them from your section in MAINTAINERS and add a new "QMP scripts" section where you can mark the scripts/qmp folder as orphan.

Thomas

#14 lore raw
In reply to Thomas Huth
Quoted 10 lines · Thomas Huth
Quoted 4 lines · Markus Armbruster

Markus Armbruster (3):
scripts/qmp/qom-fuse: Unbreak import of QEMUMonitorProtocol scripts/qmp/qom-fuse: Port to current Python module fuse scripts/qmp/qom-fuse: Fix getattr(), read() for files in /

Could it be added to a CI pipeline, so that it does not bitrot again?

Thomas

Honestly, I'm working on it, but I could use some help getting the python directory into shape so I can do it.

I am trying to add pylint/mypy/flake8 tests to python/qemu to prevent that code from bitrot, but the review/discussion there didn't go anywhere.

Once there is a solid regime in place for python/qemu/ that is part of CI, I can work on moving more scripts and tooling there to start including those as part of the CI regime to prevent rot.

--js