[libvirt] [PATCH 1/1] Add trigger of host rescan
Daniel Veillard
veillard at redhat.com
Mon Apr 6 08:38:02 UTC 2009
On Fri, Apr 03, 2009 at 04:53:07PM -0400, David Allan wrote:
> The scsi host code does not currently rescan for new LUs when refreshing
> a pool. This patch causes a scan for new LUs on all targets. It does
> not cause a LIP.
LIP ?
> static int
> +virStorageBackendSCSIStartPool(virConnectPtr conn ATTRIBUTE_UNUSED,
> + virStoragePoolObjPtr pool ATTRIBUTE_UNUSED)
> +{
> + int retval = 0;
> +
> + return retval;
> +}
> +
> +
> +static int
> +virStorageBackendSCSIStopPool(virConnectPtr conn ATTRIBUTE_UNUSED,
> + virStoragePoolObjPtr pool ATTRIBUTE_UNUSED)
> +{
> + int retval = 0;
> +
> + return retval;
> +}
Is that really better than suggesting the operation is not supported ?
[...]
> + if (virAsprintf(&path, "/sys/class/scsi_host/host%u/scan", host) < 0) {
> + virReportOOMError(conn);
> + retval = -1;
> + goto out;
> + }
> +
> + VIR_DEBUG(_("Scan trigger path is '%s'"), path);
> +
> + fd = open(path, O_WRONLY);
> +
> + if (fd < 0) {
> + virReportSystemError(conn, errno,
> + _("Could not open '%s' to trigger host scan"),
> + path);
> + retval = -1;
> + goto cleanup;
> + }
> +
> + if (write(fd,
> + LINUX_SYSFS_SCSI_HOST_SCAN_STRING,
> + sizeof(LINUX_SYSFS_SCSI_HOST_SCAN_STRING)) < 0) {
> +
> + virReportSystemError(conn, errno,
> + _("Write to '%s' to trigger host scan failed"),
> + path);
> + retval = -1;
> + goto cleanup;
> + }
> +
> + goto out;
Seems to me that goto should be suppressed, it just generate a leak of path
On the other hand fd is leaked for sure ... This really need some
double-checking ;-)
> +cleanup:
> + VIR_FREE(path);
> +
> +out:
> + VIR_DEBUG(_("Rescan of host %d complete"), host);
> + return retval;
> +}
Otherwise, sounds fine, as long as this doesn't generate a bus reset.
Daniel
--
Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/
daniel at veillard.com | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library http://libvirt.org/
More information about the libvir-list
mailing list