mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-07-31 14:07:16 +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>
|
</optional>
|
||||||
</element>
|
</element>
|
||||||
</optional>
|
</optional>
|
||||||
|
<optional>
|
||||||
|
<ref name="address"/>
|
||||||
|
</optional>
|
||||||
</element>
|
</element>
|
||||||
</define>
|
</define>
|
||||||
<!--
|
<!--
|
||||||
@ -1043,6 +1046,9 @@
|
|||||||
<value>ac97</value>
|
<value>ac97</value>
|
||||||
</choice>
|
</choice>
|
||||||
</attribute>
|
</attribute>
|
||||||
|
<optional>
|
||||||
|
<ref name="address"/>
|
||||||
|
</optional>
|
||||||
</element>
|
</element>
|
||||||
</define>
|
</define>
|
||||||
<define name="watchdog">
|
<define name="watchdog">
|
||||||
@ -1064,6 +1070,9 @@
|
|||||||
</choice>
|
</choice>
|
||||||
</attribute>
|
</attribute>
|
||||||
</optional>
|
</optional>
|
||||||
|
<optional>
|
||||||
|
<ref name="address"/>
|
||||||
|
</optional>
|
||||||
</element>
|
</element>
|
||||||
</define>
|
</define>
|
||||||
<define name="parallel">
|
<define name="parallel">
|
||||||
|
@ -465,6 +465,8 @@ void virDomainSoundDefFree(virDomainSoundDefPtr def)
|
|||||||
if (!def)
|
if (!def)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
virDomainDeviceInfoClear(&def->info);
|
||||||
|
|
||||||
VIR_FREE(def);
|
VIR_FREE(def);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -473,6 +475,8 @@ void virDomainWatchdogDefFree(virDomainWatchdogDefPtr def)
|
|||||||
if (!def)
|
if (!def)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
virDomainDeviceInfoClear(&def->info);
|
||||||
|
|
||||||
VIR_FREE(def);
|
VIR_FREE(def);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -481,6 +485,8 @@ void virDomainVideoDefFree(virDomainVideoDefPtr def)
|
|||||||
if (!def)
|
if (!def)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
virDomainDeviceInfoClear(&def->info);
|
||||||
|
|
||||||
VIR_FREE(def->accel);
|
VIR_FREE(def->accel);
|
||||||
VIR_FREE(def);
|
VIR_FREE(def);
|
||||||
}
|
}
|
||||||
@ -2259,8 +2265,8 @@ error:
|
|||||||
static virDomainSoundDefPtr
|
static virDomainSoundDefPtr
|
||||||
virDomainSoundDefParseXML(virConnectPtr conn,
|
virDomainSoundDefParseXML(virConnectPtr conn,
|
||||||
const xmlNodePtr node,
|
const xmlNodePtr node,
|
||||||
int flags ATTRIBUTE_UNUSED) {
|
int flags)
|
||||||
|
{
|
||||||
char *model;
|
char *model;
|
||||||
virDomainSoundDefPtr def;
|
virDomainSoundDefPtr def;
|
||||||
|
|
||||||
@ -2276,6 +2282,9 @@ virDomainSoundDefParseXML(virConnectPtr conn,
|
|||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (virDomainDeviceInfoParseXML(conn, node, &def->info, flags) < 0)
|
||||||
|
goto error;
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
VIR_FREE(model);
|
VIR_FREE(model);
|
||||||
|
|
||||||
@ -2291,7 +2300,8 @@ error:
|
|||||||
static virDomainWatchdogDefPtr
|
static virDomainWatchdogDefPtr
|
||||||
virDomainWatchdogDefParseXML(virConnectPtr conn,
|
virDomainWatchdogDefParseXML(virConnectPtr conn,
|
||||||
const xmlNodePtr node,
|
const xmlNodePtr node,
|
||||||
int flags ATTRIBUTE_UNUSED) {
|
int flags)
|
||||||
|
{
|
||||||
|
|
||||||
char *model = NULL;
|
char *model = NULL;
|
||||||
char *action = NULL;
|
char *action = NULL;
|
||||||
@ -2327,6 +2337,9 @@ virDomainWatchdogDefParseXML(virConnectPtr conn,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (virDomainDeviceInfoParseXML(conn, node, &def->info, flags) < 0)
|
||||||
|
goto error;
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
VIR_FREE (action);
|
VIR_FREE (action);
|
||||||
VIR_FREE (model);
|
VIR_FREE (model);
|
||||||
@ -2439,7 +2452,7 @@ static virDomainVideoDefPtr
|
|||||||
virDomainVideoDefParseXML(virConnectPtr conn,
|
virDomainVideoDefParseXML(virConnectPtr conn,
|
||||||
const xmlNodePtr node,
|
const xmlNodePtr node,
|
||||||
virDomainDefPtr dom,
|
virDomainDefPtr dom,
|
||||||
int flags ATTRIBUTE_UNUSED) {
|
int flags) {
|
||||||
virDomainVideoDefPtr def;
|
virDomainVideoDefPtr def;
|
||||||
xmlNodePtr cur;
|
xmlNodePtr cur;
|
||||||
char *type = NULL;
|
char *type = NULL;
|
||||||
@ -2499,6 +2512,9 @@ virDomainVideoDefParseXML(virConnectPtr conn,
|
|||||||
def->heads = 1;
|
def->heads = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (virDomainDeviceInfoParseXML(conn, node, &def->info, flags) < 0)
|
||||||
|
goto error;
|
||||||
|
|
||||||
VIR_FREE(type);
|
VIR_FREE(type);
|
||||||
VIR_FREE(vram);
|
VIR_FREE(vram);
|
||||||
VIR_FREE(heads);
|
VIR_FREE(heads);
|
||||||
@ -2927,8 +2943,7 @@ virDomainDeviceDefPtr virDomainDeviceDefParse(virConnectPtr conn,
|
|||||||
goto error;
|
goto error;
|
||||||
} else if (xmlStrEqual(node->name, BAD_CAST "watchdog")) {
|
} else if (xmlStrEqual(node->name, BAD_CAST "watchdog")) {
|
||||||
dev->type = VIR_DOMAIN_DEVICE_WATCHDOG;
|
dev->type = VIR_DOMAIN_DEVICE_WATCHDOG;
|
||||||
if (!(dev->data.watchdog = virDomainWatchdogDefParseXML(conn, node,
|
if (!(dev->data.watchdog = virDomainWatchdogDefParseXML(conn, node, flags)))
|
||||||
flags)))
|
|
||||||
goto error;
|
goto error;
|
||||||
} else if (xmlStrEqual(node->name, BAD_CAST "video")) {
|
} else if (xmlStrEqual(node->name, BAD_CAST "video")) {
|
||||||
dev->type = VIR_DOMAIN_DEVICE_VIDEO;
|
dev->type = VIR_DOMAIN_DEVICE_VIDEO;
|
||||||
@ -3637,7 +3652,7 @@ static virDomainDefPtr virDomainDefParseXML(virConnectPtr conn,
|
|||||||
}
|
}
|
||||||
if (n > 0) {
|
if (n > 0) {
|
||||||
virDomainWatchdogDefPtr watchdog =
|
virDomainWatchdogDefPtr watchdog =
|
||||||
virDomainWatchdogDefParseXML (conn, nodes[0], flags);
|
virDomainWatchdogDefParseXML(conn, nodes[0], flags);
|
||||||
if (!watchdog)
|
if (!watchdog)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
@ -4550,9 +4565,18 @@ virDomainSoundDefFormat(virConnectPtr conn,
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
virBufferVSprintf(buf, " <sound model='%s'/>\n",
|
virBufferVSprintf(buf, " <sound model='%s'",
|
||||||
model);
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4577,9 +4601,18 @@ virDomainWatchdogDefFormat(virConnectPtr conn,
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
virBufferVSprintf(buf, " <watchdog model='%s' action='%s'/>\n",
|
virBufferVSprintf(buf, " <watchdog model='%s' action='%s'",
|
||||||
model, action);
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4624,6 +4657,9 @@ virDomainVideoDefFormat(virConnectPtr conn,
|
|||||||
virBufferAddLit(buf, "/>\n");
|
virBufferAddLit(buf, "/>\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (virDomainDeviceInfoFormat(buf, &def->info) < 0)
|
||||||
|
return -1;
|
||||||
|
|
||||||
virBufferAddLit(buf, " </video>\n");
|
virBufferAddLit(buf, " </video>\n");
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -335,6 +335,7 @@ typedef struct _virDomainSoundDef virDomainSoundDef;
|
|||||||
typedef virDomainSoundDef *virDomainSoundDefPtr;
|
typedef virDomainSoundDef *virDomainSoundDefPtr;
|
||||||
struct _virDomainSoundDef {
|
struct _virDomainSoundDef {
|
||||||
int model;
|
int model;
|
||||||
|
virDomainDeviceInfo info;
|
||||||
};
|
};
|
||||||
|
|
||||||
enum virDomainWatchdogModel {
|
enum virDomainWatchdogModel {
|
||||||
@ -359,6 +360,7 @@ typedef virDomainWatchdogDef *virDomainWatchdogDefPtr;
|
|||||||
struct _virDomainWatchdogDef {
|
struct _virDomainWatchdogDef {
|
||||||
int model;
|
int model;
|
||||||
int action;
|
int action;
|
||||||
|
virDomainDeviceInfo info;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -388,6 +390,7 @@ struct _virDomainVideoDef {
|
|||||||
unsigned int vram;
|
unsigned int vram;
|
||||||
unsigned int heads;
|
unsigned int heads;
|
||||||
virDomainVideoAccelDefPtr accel;
|
virDomainVideoAccelDefPtr accel;
|
||||||
|
virDomainDeviceInfo info;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* 3 possible graphics console modes */
|
/* 3 possible graphics console modes */
|
||||||
|
Loading…
Reference in New Issue
Block a user