path, prop = "type".rsplit('/', 1) sets path to "", which doesn't
work. Correct to "/".
Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
scripts/qmp/qom-fuse | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/scripts/qmp/qom-fuse b/scripts/qmp/qom-fuse
index 405e6ebd67..7c7cff8edf 100755
--- a/scripts/qmp/qom-fuse
+++ b/scripts/qmp/qom-fuse
@@ -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
--
2.26.2
On 7/23/20 4:27 PM, Markus Armbruster wrote:
> path, prop = "type".rsplit('/', 1) sets path to "", which doesn't
> work. Correct to "/".
>
> Signed-off-by: Markus Armbruster <armbru@redhat.com>
> ---
> scripts/qmp/qom-fuse | 10 ++++++++--
> 1 file changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/scripts/qmp/qom-fuse b/scripts/qmp/qom-fuse
> index 405e6ebd67..7c7cff8edf 100755
> --- a/scripts/qmp/qom-fuse
> +++ b/scripts/qmp/qom-fuse
> @@ -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?
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> 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
>
Philippe Mathieu-Daudé <philmd@redhat.com> writes:
> On 7/23/20 4:27 PM, Markus Armbruster wrote:
>> path, prop = "type".rsplit('/', 1) sets path to "", which doesn't
>> work. Correct to "/".
>>
>> Signed-off-by: Markus Armbruster <armbru@redhat.com>
>> ---
>> scripts/qmp/qom-fuse | 10 ++++++++--
>> 1 file changed, 8 insertions(+), 2 deletions(-)
>>
>> diff --git a/scripts/qmp/qom-fuse b/scripts/qmp/qom-fuse
>> index 405e6ebd67..7c7cff8edf 100755
>> --- a/scripts/qmp/qom-fuse
>> +++ b/scripts/qmp/qom-fuse
>> @@ -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?
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.
> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Thanks!
[...]
On 7/23/20 10:27 AM, Markus Armbruster wrote:
> path, prop = "type".rsplit('/', 1) sets path to "", which doesn't
> work. Correct to "/".
>
BOTD. If it works for you, that's good news.
Reviewed-by: John Snow <jsnow@redhat.com>
> Signed-off-by: Markus Armbruster <armbru@redhat.com>
> ---
> scripts/qmp/qom-fuse | 10 ++++++++--
> 1 file changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/scripts/qmp/qom-fuse b/scripts/qmp/qom-fuse
> index 405e6ebd67..7c7cff8edf 100755
> --- a/scripts/qmp/qom-fuse
> +++ b/scripts/qmp/qom-fuse
> @@ -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
>
© 2016 - 2026 Red Hat, Inc.