[libvirt] [PATCH v2 07/12] conf: Change when virDomainHostdevAssignAddress is called

Ján Tomko jtomko at redhat.com
Mon Aug 3 13:26:20 UTC 2015


On Wed, Jul 22, 2015 at 10:54:29AM -0400, John Ferlan wrote:
> Rather than calling virDomainHostdevAssignAddress during the parsing
> of the XML, move the setting of a default hostdev address to domain/
> device post processing.
> 
> Since the parse code no longer generates an address, we can remove
> the virDomainDefMaybeAddHostdevSCSIcontroller since the call to
> virDomainHostdevAssignAddress will attempt to add the controllers
> that were not already defined in the XML.
> 
> This patch will also enforce that the address type is type 'drive'
> when a SCSI subsystem <hostdev> element is provided with an <address>.
> 
> Signed-off-by: John Ferlan <jferlan at redhat.com>
> ---
>  docs/formatdomain.html.in |  4 ++--
>  src/conf/domain_conf.c    | 29 +++++++++++++++++++----------
>  2 files changed, 21 insertions(+), 12 deletions(-)
> 
> diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
> index d0c1741..e78fb26 100644
> --- a/docs/formatdomain.html.in
> +++ b/docs/formatdomain.html.in
> @@ -3355,8 +3355,8 @@
>        (starting with 0x) or octal (starting with 0) form.
>        For PCI devices the element carries 4 attributes allowing to designate
>        the device as can be found with the <code>lspci</code> or
> -      with <code>virsh
> -      nodedev-list</code>. <a href="#elementsAddress">See above</a> for
> +      with <code>virsh nodedev-list</code>. For SCSI devices a 'drive'
> +      address type must be used. <a href="#elementsAddress">See above</a> for
>        more details on the address element.</dd>
>        <dt><code>driver</code></dt>
>        <dd>
> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
> index 9c6c739..eabba68 100644
> --- a/src/conf/domain_conf.c
> +++ b/src/conf/domain_conf.c
> @@ -3997,7 +3997,7 @@ static int
>  virDomainDeviceDefPostParseInternal(virDomainDeviceDefPtr dev,
>                                      const virDomainDef *def,
>                                      virCapsPtr caps ATTRIBUTE_UNUSED,
> -                                    virDomainXMLOptionPtr xmlopt ATTRIBUTE_UNUSED)
> +                                    virDomainXMLOptionPtr xmlopt)
>  {
>      if (dev->type == VIR_DOMAIN_DEVICE_CHR) {
>          virDomainChrDefPtr chr = dev->data.chr;
> @@ -4085,6 +4085,18 @@ virDomainDeviceDefPostParseInternal(virDomainDeviceDefPtr dev,
>          video->vram = VIR_ROUND_UP_POWER_OF_TWO(video->vram);
>      }
>  
> +    if (dev->type == VIR_DOMAIN_DEVICE_HOSTDEV) {
> +        virDomainHostdevDefPtr hdev = dev->data.hostdev;
> +
> +        if (hdev->mode == VIR_DOMAIN_HOSTDEV_MODE_SUBSYS &&
> +            hdev->source.subsys.type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI &&
> +            hdev->info->type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE &&
> +            virDomainHostdevAssignAddress(xmlopt, def, hdev) < 0) {
> +                virReportError(VIR_ERR_XML_ERROR, "%s",
> +                               _("Cannot assign SCSI host devices address "));

host device's?

There's also a trailing space.

Jan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20150803/d4eb86a9/attachment-0001.sig>


More information about the libvir-list mailing list