mirror of https://gitee.com/openkylin/libvirt.git
hvsupport: Split out common APIs from hypervisor API section
Common APIs such as virConnectOpen/Close and similar which are used by the non-hypervisor drivers in libvirt are grouped together with hypervisor drivers, which makes the table very wide. Split them out into a separate group and clean up the list of hypervisor drivers. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
eca6846376
commit
dc9c6c5405
|
@ -49,8 +49,19 @@ groupheaders = {
|
||||||
"virStorageDriver": "Storage Pool APIs",
|
"virStorageDriver": "Storage Pool APIs",
|
||||||
"virSecretDriver": "Secret APIs",
|
"virSecretDriver": "Secret APIs",
|
||||||
"virNWFilterDriver": "Network Filter APIs",
|
"virNWFilterDriver": "Network Filter APIs",
|
||||||
|
"commonapis": "Common driver APIs",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# List of common APIs used with all driver kinds
|
||||||
|
commonapis = [
|
||||||
|
"virConnectOpen",
|
||||||
|
"virConnectClose",
|
||||||
|
"virConnectIsAlive",
|
||||||
|
"virConnectIsEncrypted",
|
||||||
|
"virConnectIsSecure",
|
||||||
|
"virConnectSupportsFeature",
|
||||||
|
"virConnectGetCapabilities",
|
||||||
|
]
|
||||||
|
|
||||||
srcs = []
|
srcs = []
|
||||||
for root, dirs, files in os.walk(os.path.join(srcdir, "src")):
|
for root, dirs, files in os.walk(os.path.join(srcdir, "src")):
|
||||||
|
@ -222,6 +233,10 @@ apis["virDomainMigrateConfirm3Params"] = {
|
||||||
|
|
||||||
# Group name -> hash of APIs { fields -> api name }
|
# Group name -> hash of APIs { fields -> api name }
|
||||||
groups = {}
|
groups = {}
|
||||||
|
groups["commonapis"] = {
|
||||||
|
"apis": {},
|
||||||
|
"drivers": {}
|
||||||
|
}
|
||||||
ingrp = None
|
ingrp = None
|
||||||
for drivertablefile in drivertablefiles:
|
for drivertablefile in drivertablefiles:
|
||||||
with open(drivertablefile) as fh:
|
with open(drivertablefile) as fh:
|
||||||
|
@ -244,7 +259,10 @@ for drivertablefile in drivertablefiles:
|
||||||
|
|
||||||
api = "vir" + name
|
api = "vir" + name
|
||||||
if api in apis:
|
if api in apis:
|
||||||
groups[ingrp]["apis"][field] = api
|
if api in commonapis:
|
||||||
|
groups["commonapis"]["apis"][field] = api
|
||||||
|
else:
|
||||||
|
groups[ingrp]["apis"][field] = api
|
||||||
elif re.search(r"\w+(Open|Close|URIProbe)", api) is not None:
|
elif re.search(r"\w+(Open|Close|URIProbe)", api) is not None:
|
||||||
continue
|
continue
|
||||||
else:
|
else:
|
||||||
|
@ -288,6 +306,9 @@ for src in srcs:
|
||||||
"Group %s already contains %s" % (ingrp, impl))
|
"Group %s already contains %s" % (ingrp, impl))
|
||||||
|
|
||||||
groups[ingrp]["drivers"][impl] = {}
|
groups[ingrp]["drivers"][impl] = {}
|
||||||
|
|
||||||
|
if impl not in groups["commonapis"]["drivers"]:
|
||||||
|
groups["commonapis"]["drivers"][impl] = {}
|
||||||
else:
|
else:
|
||||||
callbackmatch = re.search(r"\s*\.(\w+)\s*=\s*(\w+)\s*,?\s*" +
|
callbackmatch = re.search(r"\s*\.(\w+)\s*=\s*(\w+)\s*,?\s*" +
|
||||||
r"(?:/\*\s*(\d+\.\d+\.\d+)\s*" +
|
r"(?:/\*\s*(\d+\.\d+\.\d+)\s*" +
|
||||||
|
@ -317,18 +338,23 @@ for src in srcs:
|
||||||
"Method %s in %s is missing version" %
|
"Method %s in %s is missing version" %
|
||||||
(meth, src))
|
(meth, src))
|
||||||
|
|
||||||
if api not in groups[ingrp]["apis"]:
|
if api in groups["commonapis"]["apis"]:
|
||||||
|
groups["commonapis"]["drivers"][impl][api] = {
|
||||||
|
"vers": vers,
|
||||||
|
"deleted": deleted,
|
||||||
|
}
|
||||||
|
elif api in groups[ingrp]["apis"]:
|
||||||
|
groups[ingrp]["drivers"][impl][api] = {
|
||||||
|
"vers": vers,
|
||||||
|
"deleted": deleted,
|
||||||
|
}
|
||||||
|
else:
|
||||||
if re.search(r"\w+(Open|Close|URIProbe)", api):
|
if re.search(r"\w+(Open|Close|URIProbe)", api):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
raise Exception("Found unexpected method " +
|
raise Exception("Found unexpected method " +
|
||||||
"%s in %s" % (api, ingrp))
|
"%s in %s" % (api, ingrp))
|
||||||
|
|
||||||
groups[ingrp]["drivers"][impl][api] = {
|
|
||||||
"vers": vers,
|
|
||||||
"deleted": deleted,
|
|
||||||
}
|
|
||||||
|
|
||||||
if (api == "domainMigratePrepare" or
|
if (api == "domainMigratePrepare" or
|
||||||
api == "domainMigratePrepare2" or
|
api == "domainMigratePrepare2" or
|
||||||
api == "domainMigratePrepare3"):
|
api == "domainMigratePrepare3"):
|
||||||
|
@ -345,16 +371,16 @@ for src in srcs:
|
||||||
# have a bit of manual fixup todo with the per-driver versioning
|
# have a bit of manual fixup todo with the per-driver versioning
|
||||||
# and support matrix
|
# and support matrix
|
||||||
|
|
||||||
groups["virHypervisorDriver"]["apis"]["connectOpenAuth"] = \
|
groups["commonapis"]["apis"]["connectOpenAuth"] = \
|
||||||
"virConnectOpenAuth"
|
"virConnectOpenAuth"
|
||||||
groups["virHypervisorDriver"]["apis"]["connectOpenReadOnly"] = \
|
groups["commonapis"]["apis"]["connectOpenReadOnly"] = \
|
||||||
"virConnectOpenReadOnly"
|
"virConnectOpenReadOnly"
|
||||||
groups["virHypervisorDriver"]["apis"]["domainMigrate"] = \
|
groups["virHypervisorDriver"]["apis"]["domainMigrate"] = \
|
||||||
"virDomainMigrate"
|
"virDomainMigrate"
|
||||||
|
|
||||||
openAuthVers = (0 * 1000 * 1000) + (4 * 1000) + 0
|
openAuthVers = (0 * 1000 * 1000) + (4 * 1000) + 0
|
||||||
|
|
||||||
drivers = groups["virHypervisorDriver"]["drivers"]
|
drivers = groups["commonapis"]["drivers"]
|
||||||
for drv in drivers.keys():
|
for drv in drivers.keys():
|
||||||
openVersStr = drivers[drv]["connectOpen"]["vers"]
|
openVersStr = drivers[drv]["connectOpen"]["vers"]
|
||||||
openVers = 0
|
openVers = 0
|
||||||
|
@ -381,7 +407,7 @@ for drv in drivers.keys():
|
||||||
"vers": vers,
|
"vers": vers,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
drivers = groups["virHypervisorDriver"]["drivers"]
|
||||||
# Another special case for the virDomainCreateLinux which was replaced
|
# Another special case for the virDomainCreateLinux which was replaced
|
||||||
# with virDomainCreateXML
|
# with virDomainCreateXML
|
||||||
groups["virHypervisorDriver"]["apis"]["domainCreateLinux"] = \
|
groups["virHypervisorDriver"]["apis"]["domainCreateLinux"] = \
|
||||||
|
@ -389,7 +415,12 @@ groups["virHypervisorDriver"]["apis"]["domainCreateLinux"] = \
|
||||||
|
|
||||||
createAPIVers = (0 * 1000 * 1000) + (0 * 1000) + 3
|
createAPIVers = (0 * 1000 * 1000) + (0 * 1000) + 3
|
||||||
|
|
||||||
for drv in drivers.keys():
|
for drv in list(drivers.keys()):
|
||||||
|
# drop drivers from the "virHypervisorDriver" group which have only common APIs
|
||||||
|
if len(drivers[drv]) == 0:
|
||||||
|
drivers.pop(drv)
|
||||||
|
continue
|
||||||
|
|
||||||
if "domainCreateXML" not in drivers[drv]:
|
if "domainCreateXML" not in drivers[drv]:
|
||||||
continue
|
continue
|
||||||
createVersStr = drivers[drv]["domainCreateXML"]["vers"]
|
createVersStr = drivers[drv]["domainCreateXML"]["vers"]
|
||||||
|
@ -414,7 +445,6 @@ for drv in drivers.keys():
|
||||||
"vers": vers,
|
"vers": vers,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
# Finally we generate the HTML file with the tables
|
# Finally we generate the HTML file with the tables
|
||||||
|
|
||||||
print('''<?xml version="1.0" encoding="UTF-8"?>
|
print('''<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
Loading…
Reference in New Issue