diff options
author | Michal Privoznik <mprivozn@redhat.com> | 2021-04-14 20:56:43 +0200 |
---|---|---|
committer | Michal Privoznik <mprivozn@redhat.com> | 2021-04-15 13:12:29 +0200 |
commit | 6851c5c8df212188de98cf8a41bcf7b3d1965d91 (patch) | |
tree | 5ffa5e285efceb7e77b4a2e350372ff92e105bb6 /generator.py | |
parent | 80ed19052ff79f8a7d846a8f0d9587bde288029c (diff) | |
download | libvirt-python-6851c5c8df212188de98cf8a41bcf7b3d1965d91.tar.gz |
generator.py: Fix method names for new virNodeDevice*() APIs
In the 7.3.0 release we are going to have three new public APIs:
virNodeDeviceDefineXML()
virNodeDeviceUndefine()
virNodeDeviceCreate()
The first one is slightly problematic, because it takes
virConnectPtr argument and thus our generator wants to put its
wrapper under virConnect python class, which is correct, but
what's incorrect is the name it chooses for the method:
defineXML(). Such method already exists and wraps
virDomainDefineXML() around. Also, the name is rather confusing
anyway - it's missing the 'nodeDevice' prefix.
Fortunately, the fix is easy - add another case into nameFixup().
The story with virNodeDeviceCreate() is similar. Except, this time
the class in which the method was put is correct. But the name is
still wrong, because our generator matched 'virNodeDeviceCreate'
thinking it's the good old virNodeDeviceCreateXML() API and
"fixed" the name of the method to nodeDeviceCreate().
Luckily, virNodeDeviceUndefine() is just fine.
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Diffstat (limited to 'generator.py')
-rwxr-xr-x | generator.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/generator.py b/generator.py index 656f7b8..e807223 100755 --- a/generator.py +++ b/generator.py @@ -1240,7 +1240,9 @@ def nameFixup(name: str, classe: str, type: str, file: str) -> str: elif name[0:13] == "virNodeDevice": if name[13:16] == "Get": func = name[16].lower() + name[17:] - elif name[13:19] == "Lookup" or name[13:19] == "Create": + elif name[13:19] == "Lookup" or name[13:22] == "CreateXML": + func = name[3].lower() + name[4:] + elif name[13:19] == "Define": func = name[3].lower() + name[4:] else: func = name[13].lower() + name[14:] |