mirror of https://gitee.com/openkylin/libvirt.git
hyperv: add inheritance to the WMI generator
This enables casting subtypes to their parent. Signed-off-by: Matt Coleman <matt@datto.com> Reviewed-by: Laine Stump <laine@redhat.com>
This commit is contained in:
parent
b0c3fa390b
commit
b23ada6715
|
@ -221,10 +221,10 @@ def report_error(message):
|
|||
|
||||
|
||||
def parse_class(block, number):
|
||||
# expected format: class <name>
|
||||
# expected format: class <name> : <optional parent>
|
||||
header_items = block[0][1].split()
|
||||
|
||||
if len(header_items) != 2:
|
||||
if len(header_items) not in [2, 4]:
|
||||
report_error("line %d: invalid block header" % (number))
|
||||
|
||||
assert header_items[0] == "class"
|
||||
|
@ -234,6 +234,12 @@ def parse_class(block, number):
|
|||
if name in wmi_classes_by_name:
|
||||
report_error("class '%s' has already been defined" % name)
|
||||
|
||||
if len(header_items) == 4:
|
||||
parent_class = header_items[3]
|
||||
if parent_class not in wmi_classes_by_name:
|
||||
report_error("nonexistent parent class specified: %s" % parent_class)
|
||||
properties = wmi_classes_by_name[parent_class].properties.copy()
|
||||
else:
|
||||
properties = []
|
||||
|
||||
for line in block[1:]:
|
||||
|
|
Loading…
Reference in New Issue