mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
conf: Introduce virDomainDefPostParseVideo helper
Move the video post parse bits into a separate helper as the logic is going to be extended in the future. Signed-off-by: Erik Skultety <eskultet@redhat.com> Reviewed-by: John Ferlan <jferlan@redhat.com>
This commit is contained in:
parent
f317b1e5c5
commit
75aa179ad6
@ -5087,6 +5087,34 @@ virDomainDefBootOrderPostParse(virDomainDefPtr def)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static int
|
||||||
|
virDomainDefPostParseVideo(virDomainDefPtr def,
|
||||||
|
void *opaque)
|
||||||
|
{
|
||||||
|
if (def->nvideos == 0)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
virDomainDeviceDef device = {
|
||||||
|
.type = VIR_DOMAIN_DEVICE_VIDEO,
|
||||||
|
.data.video = def->videos[0],
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Mark the first video as primary. If the user specified
|
||||||
|
* primary="yes", the parser already inserted the device at
|
||||||
|
* def->videos[0]
|
||||||
|
*/
|
||||||
|
def->videos[0]->primary = true;
|
||||||
|
|
||||||
|
/* videos[0] might have been added in AddImplicitDevices, after we've
|
||||||
|
* done the per-device post-parse */
|
||||||
|
if (virDomainDefPostParseDeviceIterator(def, &device,
|
||||||
|
NULL, opaque) < 0)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
virDomainDefPostParseCommon(virDomainDefPtr def,
|
virDomainDefPostParseCommon(virDomainDefPtr def,
|
||||||
struct virDomainDefPostParseDeviceIteratorData *data)
|
struct virDomainDefPostParseDeviceIteratorData *data)
|
||||||
@ -5123,21 +5151,8 @@ virDomainDefPostParseCommon(virDomainDefPtr def,
|
|||||||
if (virDomainDefAddImplicitDevices(def) < 0)
|
if (virDomainDefAddImplicitDevices(def) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (def->nvideos != 0) {
|
if (virDomainDefPostParseVideo(def, data) < 0)
|
||||||
virDomainDeviceDef device = {
|
return -1;
|
||||||
.type = VIR_DOMAIN_DEVICE_VIDEO,
|
|
||||||
.data.video = def->videos[0],
|
|
||||||
};
|
|
||||||
|
|
||||||
/* Mark the first video as primary. If the user specified primary="yes",
|
|
||||||
* the parser already inserted the device at def->videos[0] */
|
|
||||||
def->videos[0]->primary = true;
|
|
||||||
|
|
||||||
/* videos[0] might have been added in AddImplicitDevices, after we've
|
|
||||||
* done the per-device post-parse */
|
|
||||||
if (virDomainDefPostParseDeviceIterator(def, &device, NULL, data) < 0)
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (def->nserials != 0) {
|
if (def->nserials != 0) {
|
||||||
virDomainDeviceDef device = {
|
virDomainDeviceDef device = {
|
||||||
|
Loading…
Reference in New Issue
Block a user