mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-20 07:59:00 +00:00
Add address info to sound, video and watchdog devices
Add the virDomainDeviceAddress information to the sound, video and watchdog devices. This means all of them gain the new XML element <address .... /> This brings them upto par with disk/net/hostdev devices which already have address info * src/conf/domain_conf.h: Add virDomainDeviceAddress to sound, video & watchdog device struts. * src/conf/domain_conf.c: Hook up parsing/formatting for virDomainDeviceAddress in sound, video & watchdog devices * docs/schemas/domain.rng: Associate device address info with sound, video & watchdog
This commit is contained in:
parent
d812e7aeb8
commit
a9e4ea94f1
@ -907,6 +907,9 @@
|
||||
</optional>
|
||||
</element>
|
||||
</optional>
|
||||
<optional>
|
||||
<ref name="address"/>
|
||||
</optional>
|
||||
</element>
|
||||
</define>
|
||||
<!--
|
||||
@ -1043,6 +1046,9 @@
|
||||
<value>ac97</value>
|
||||
</choice>
|
||||
</attribute>
|
||||
<optional>
|
||||
<ref name="address"/>
|
||||
</optional>
|
||||
</element>
|
||||
</define>
|
||||
<define name="watchdog">
|
||||
@ -1064,6 +1070,9 @@
|
||||
</choice>
|
||||
</attribute>
|
||||
</optional>
|
||||
<optional>
|
||||
<ref name="address"/>
|
||||
</optional>
|
||||
</element>
|
||||
</define>
|
||||
<define name="parallel">
|
||||
|
@ -465,6 +465,8 @@ void virDomainSoundDefFree(virDomainSoundDefPtr def)
|
||||
if (!def)
|
||||
return;
|
||||
|
||||
virDomainDeviceInfoClear(&def->info);
|
||||
|
||||
VIR_FREE(def);
|
||||
}
|
||||
|
||||
@ -473,6 +475,8 @@ void virDomainWatchdogDefFree(virDomainWatchdogDefPtr def)
|
||||
if (!def)
|
||||
return;
|
||||
|
||||
virDomainDeviceInfoClear(&def->info);
|
||||
|
||||
VIR_FREE(def);
|
||||
}
|
||||
|
||||
@ -481,6 +485,8 @@ void virDomainVideoDefFree(virDomainVideoDefPtr def)
|
||||
if (!def)
|
||||
return;
|
||||
|
||||
virDomainDeviceInfoClear(&def->info);
|
||||
|
||||
VIR_FREE(def->accel);
|
||||
VIR_FREE(def);
|
||||
}
|
||||
@ -2259,8 +2265,8 @@ error:
|
||||
static virDomainSoundDefPtr
|
||||
virDomainSoundDefParseXML(virConnectPtr conn,
|
||||
const xmlNodePtr node,
|
||||
int flags ATTRIBUTE_UNUSED) {
|
||||
|
||||
int flags)
|
||||
{
|
||||
char *model;
|
||||
virDomainSoundDefPtr def;
|
||||
|
||||
@ -2276,6 +2282,9 @@ virDomainSoundDefParseXML(virConnectPtr conn,
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (virDomainDeviceInfoParseXML(conn, node, &def->info, flags) < 0)
|
||||
goto error;
|
||||
|
||||
cleanup:
|
||||
VIR_FREE(model);
|
||||
|
||||
@ -2291,7 +2300,8 @@ error:
|
||||
static virDomainWatchdogDefPtr
|
||||
virDomainWatchdogDefParseXML(virConnectPtr conn,
|
||||
const xmlNodePtr node,
|
||||
int flags ATTRIBUTE_UNUSED) {
|
||||
int flags)
|
||||
{
|
||||
|
||||
char *model = NULL;
|
||||
char *action = NULL;
|
||||
@ -2327,6 +2337,9 @@ virDomainWatchdogDefParseXML(virConnectPtr conn,
|
||||
}
|
||||
}
|
||||
|
||||
if (virDomainDeviceInfoParseXML(conn, node, &def->info, flags) < 0)
|
||||
goto error;
|
||||
|
||||
cleanup:
|
||||
VIR_FREE (action);
|
||||
VIR_FREE (model);
|
||||
@ -2439,7 +2452,7 @@ static virDomainVideoDefPtr
|
||||
virDomainVideoDefParseXML(virConnectPtr conn,
|
||||
const xmlNodePtr node,
|
||||
virDomainDefPtr dom,
|
||||
int flags ATTRIBUTE_UNUSED) {
|
||||
int flags) {
|
||||
virDomainVideoDefPtr def;
|
||||
xmlNodePtr cur;
|
||||
char *type = NULL;
|
||||
@ -2499,6 +2512,9 @@ virDomainVideoDefParseXML(virConnectPtr conn,
|
||||
def->heads = 1;
|
||||
}
|
||||
|
||||
if (virDomainDeviceInfoParseXML(conn, node, &def->info, flags) < 0)
|
||||
goto error;
|
||||
|
||||
VIR_FREE(type);
|
||||
VIR_FREE(vram);
|
||||
VIR_FREE(heads);
|
||||
@ -2927,8 +2943,7 @@ virDomainDeviceDefPtr virDomainDeviceDefParse(virConnectPtr conn,
|
||||
goto error;
|
||||
} else if (xmlStrEqual(node->name, BAD_CAST "watchdog")) {
|
||||
dev->type = VIR_DOMAIN_DEVICE_WATCHDOG;
|
||||
if (!(dev->data.watchdog = virDomainWatchdogDefParseXML(conn, node,
|
||||
flags)))
|
||||
if (!(dev->data.watchdog = virDomainWatchdogDefParseXML(conn, node, flags)))
|
||||
goto error;
|
||||
} else if (xmlStrEqual(node->name, BAD_CAST "video")) {
|
||||
dev->type = VIR_DOMAIN_DEVICE_VIDEO;
|
||||
@ -3637,7 +3652,7 @@ static virDomainDefPtr virDomainDefParseXML(virConnectPtr conn,
|
||||
}
|
||||
if (n > 0) {
|
||||
virDomainWatchdogDefPtr watchdog =
|
||||
virDomainWatchdogDefParseXML (conn, nodes[0], flags);
|
||||
virDomainWatchdogDefParseXML(conn, nodes[0], flags);
|
||||
if (!watchdog)
|
||||
goto error;
|
||||
|
||||
@ -4550,9 +4565,18 @@ virDomainSoundDefFormat(virConnectPtr conn,
|
||||
return -1;
|
||||
}
|
||||
|
||||
virBufferVSprintf(buf, " <sound model='%s'/>\n",
|
||||
virBufferVSprintf(buf, " <sound model='%s'",
|
||||
model);
|
||||
|
||||
if (virDomainDeviceInfoIsSet(&def->info)) {
|
||||
virBufferAddLit(buf, ">\n");
|
||||
if (virDomainDeviceInfoFormat(buf, &def->info) < 0)
|
||||
return -1;
|
||||
virBufferAddLit(buf, " </sound>\n");
|
||||
} else {
|
||||
virBufferAddLit(buf, "/>\n");
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -4577,9 +4601,18 @@ virDomainWatchdogDefFormat(virConnectPtr conn,
|
||||
return -1;
|
||||
}
|
||||
|
||||
virBufferVSprintf(buf, " <watchdog model='%s' action='%s'/>\n",
|
||||
virBufferVSprintf(buf, " <watchdog model='%s' action='%s'",
|
||||
model, action);
|
||||
|
||||
if (virDomainDeviceInfoIsSet(&def->info)) {
|
||||
virBufferAddLit(buf, ">\n");
|
||||
if (virDomainDeviceInfoFormat(buf, &def->info) < 0)
|
||||
return -1;
|
||||
virBufferAddLit(buf, " </watchdog>\n");
|
||||
} else {
|
||||
virBufferAddLit(buf, "/>\n");
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -4624,6 +4657,9 @@ virDomainVideoDefFormat(virConnectPtr conn,
|
||||
virBufferAddLit(buf, "/>\n");
|
||||
}
|
||||
|
||||
if (virDomainDeviceInfoFormat(buf, &def->info) < 0)
|
||||
return -1;
|
||||
|
||||
virBufferAddLit(buf, " </video>\n");
|
||||
|
||||
return 0;
|
||||
|
@ -335,6 +335,7 @@ typedef struct _virDomainSoundDef virDomainSoundDef;
|
||||
typedef virDomainSoundDef *virDomainSoundDefPtr;
|
||||
struct _virDomainSoundDef {
|
||||
int model;
|
||||
virDomainDeviceInfo info;
|
||||
};
|
||||
|
||||
enum virDomainWatchdogModel {
|
||||
@ -359,6 +360,7 @@ typedef virDomainWatchdogDef *virDomainWatchdogDefPtr;
|
||||
struct _virDomainWatchdogDef {
|
||||
int model;
|
||||
int action;
|
||||
virDomainDeviceInfo info;
|
||||
};
|
||||
|
||||
|
||||
@ -388,6 +390,7 @@ struct _virDomainVideoDef {
|
||||
unsigned int vram;
|
||||
unsigned int heads;
|
||||
virDomainVideoAccelDefPtr accel;
|
||||
virDomainDeviceInfo info;
|
||||
};
|
||||
|
||||
/* 3 possible graphics console modes */
|
||||
|
Loading…
x
Reference in New Issue
Block a user