mirror of https://github.com/xemu-project/xemu.git
scripts/qmp/qom-fuse: Fix getattr(), read() for files in /
path, prop = "type".rsplit('/', 1) sets path to "", which doesn't work. Correct to "/". Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20200723142738.1868568-4-armbru@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Reviewed-by: John Snow <jsnow@redhat.com>
This commit is contained in:
parent
f713ed4f7e
commit
3a14019e82
|
@ -45,8 +45,10 @@ class QOMFS(Operations):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def is_property(self, path):
|
def is_property(self, path):
|
||||||
try:
|
|
||||||
path, prop = path.rsplit('/', 1)
|
path, prop = path.rsplit('/', 1)
|
||||||
|
if path == '':
|
||||||
|
path = '/'
|
||||||
|
try:
|
||||||
for item in self.qmp.command('qom-list', path=path):
|
for item in self.qmp.command('qom-list', path=path):
|
||||||
if item['name'] == prop:
|
if item['name'] == prop:
|
||||||
return True
|
return True
|
||||||
|
@ -55,8 +57,10 @@ class QOMFS(Operations):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def is_link(self, path):
|
def is_link(self, path):
|
||||||
try:
|
|
||||||
path, prop = path.rsplit('/', 1)
|
path, prop = path.rsplit('/', 1)
|
||||||
|
if path == '':
|
||||||
|
path = '/'
|
||||||
|
try:
|
||||||
for item in self.qmp.command('qom-list', path=path):
|
for item in self.qmp.command('qom-list', path=path):
|
||||||
if item['name'] == prop:
|
if item['name'] == prop:
|
||||||
if item['type'].startswith('link<'):
|
if item['type'].startswith('link<'):
|
||||||
|
@ -71,6 +75,8 @@ class QOMFS(Operations):
|
||||||
return -ENOENT
|
return -ENOENT
|
||||||
|
|
||||||
path, prop = path.rsplit('/', 1)
|
path, prop = path.rsplit('/', 1)
|
||||||
|
if path == '':
|
||||||
|
path = '/'
|
||||||
try:
|
try:
|
||||||
data = 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
|
data += '\n' # make values shell friendly
|
||||||
|
|
Loading…
Reference in New Issue