Re: [PATCH v2 09/12] conf: Add SCSI hostdev check for disk drive address already in use

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Jul 22, 2015 at 10:54:31AM -0400, John Ferlan wrote:
> https://bugzilla.redhat.com/show_bug.cgi?id=1210587  (partial)
> 
> If a SCSI subsystem <hostdev> element address is provided, we need to
> make sure the address provided doesn't conflict with an existing or
> libvirt generated address for a SCSI <disk> element.
> 
> This will fix the issue where the domain XML provided an <address> for
> the <hostdev>, but not the <disk> element where the address provided
> ends up being the same address used for the <disk>. A <disk> address
> is generated using it's assigned <target> 'dev' name prior to the
> check/validation of the <hostdev> address value.
> 
> Signed-off-by: John Ferlan <jferlan@xxxxxxxxxx>
> ---
>  src/conf/domain_conf.c | 22 +++++++++++++++++++++-
>  1 file changed, 21 insertions(+), 1 deletion(-)
> 
> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
> index 44ce71b..eba264d 100644
> --- a/src/conf/domain_conf.c
> +++ b/src/conf/domain_conf.c
> @@ -11872,7 +11872,7 @@ virDomainVideoDefParseXML(xmlNodePtr node,
>  }
>  
>  static virDomainHostdevDefPtr
> -virDomainHostdevDefParseXML(const virDomainDef *vmdef ATTRIBUTE_UNUSED,
> +virDomainHostdevDefParseXML(const virDomainDef *vmdef,
>                              xmlNodePtr node,
>                              xmlXPathContextPtr ctxt,
>                              virHashTablePtr bootHash,
> @@ -11939,6 +11939,26 @@ virDomainHostdevDefParseXML(const virDomainDef *vmdef ATTRIBUTE_UNUSED,
>                                 _("SCSI host device must use 'drive' "
>                                   "address type"));
>                  goto error;
> +            } else if (def->info->type ==
> +                       VIR_DOMAIN_DEVICE_ADDRESS_TYPE_DRIVE) {
> +                /* Ensure provided address doesn't conflict with existing
> +                 * scsi disk drive address
> +                 */
> +                virDomainDeviceDriveAddressPtr addr = &def->info->addr.drive;
> +                if (virDomainDriveAddressIsUsedByDisk(vmdef,
> +                                                      VIR_DOMAIN_DISK_BUS_SCSI,
> +                                                      addr->controller,
> +                                                      addr->bus,
> +                                                      addr->target,
> +                                                      addr->unit)) {

This check seems out of place in HostdevDefParse. It also does not
check for conflicts with other hostdevs.

Jan

> +                    virReportError(VIR_ERR_XML_ERROR,
> +                                   _("SCSI host address controller='%u' "
> +                                     "bus='%u' target='%u' unit='%u' in "
> +                                     "use by a SCSI disk"),
> +                                   addr->controller, addr->bus,
> +                                   addr->target, addr->unit);
> +                    goto error;
> +                }
>              }
>  
>              if (virXPathBoolean("boolean(./readonly)", ctxt))
> -- 
> 2.1.0
> 
> --
> libvir-list mailing list
> libvir-list@xxxxxxxxxx
> https://www.redhat.com/mailman/listinfo/libvir-list

Attachment: signature.asc
Description: Digital signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]