Re: [libvirt] [PATCH 2/5] Print SCSI logical unit as unsigned integer
On 06/16/2015 11:29 PM, Eric Farman wrote: > The logical unit field is an unsigned integer, we should > use the appropriate substitution when printing it. > > Signed-off-by: Eric Farman > --- > src/conf/domain_audit.c | 2 +- > src/conf/domain_conf.c | 2 +- > src/qemu/qemu_hotplug.c | 4 ++-- > src/util/virhostdev.c | 6 +++--- > src/util/virscsi.c | 6 +++--- > tools/virsh-domain.c| 2 +- > 6 files changed, 11 insertions(+), 11 deletions(-) > Similar to 1/5 - why only adjust unit, adjust bus & target too since they're incorrect. I will adjust when I push (and change commit message to reflect that). John > diff --git a/src/conf/domain_audit.c b/src/conf/domain_audit.c > index 1900039..c94cae8 100644 > --- a/src/conf/domain_audit.c > +++ b/src/conf/domain_audit.c > @@ -427,7 +427,7 @@ virDomainAuditHostdev(virDomainObjPtr vm, > virDomainHostdevDefPtr hostdev, > } else { > virDomainHostdevSubsysSCSIHostPtr scsihostsrc = > &scsisrc->u.host; > -if (virAsprintfQuiet(&address, "%s:%d:%d:%d", > +if (virAsprintfQuiet(&address, "%s:%d:%d:%u", > scsihostsrc->adapter, scsihostsrc->bus, > scsihostsrc->target, > scsihostsrc->unit) < 0) { > diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c > index 9e77b87..7e3ca36 100644 > --- a/src/conf/domain_conf.c > +++ b/src/conf/domain_conf.c > @@ -18940,7 +18940,7 @@ virDomainHostdevDefFormatSubsys(virBufferPtr buf, > virBufferAsprintf(buf, "\n", >scsihostsrc->adapter); > virBufferAsprintf(buf, > - " unit='%d'/>\n", > + " unit='%u'/>\n", >includeTypeInAddr ? "type='scsi' " : "", >scsihostsrc->bus, scsihostsrc->target, >scsihostsrc->unit); > diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c > index cc86a3b..1d538a0 100644 > --- a/src/qemu/qemu_hotplug.c > +++ b/src/qemu/qemu_hotplug.c > @@ -1938,7 +1938,7 @@ qemuDomainAttachHostSCSIDevice(virConnectPtr conn, > } else { > virDomainHostdevSubsysSCSIHostPtr scsihostsrc = &scsisrc->u.host; > virReportError(VIR_ERR_INTERNAL_ERROR, > - _("Unable to prepare scsi hostdev: %s:%d:%d:%d"), > + _("Unable to prepare scsi hostdev: %s:%d:%d:%u"), > scsihostsrc->adapter, scsihostsrc->bus, > scsihostsrc->target, scsihostsrc->unit); > } > @@ -3873,7 +3873,7 @@ int qemuDomainDetachHostDevice(virQEMUDriverPtr driver, > virDomainHostdevSubsysSCSIHostPtr scsihostsrc = > &scsisrc->u.host; > virReportError(VIR_ERR_OPERATION_FAILED, > -_("host scsi device %s:%d:%d.%d not found"), > +_("host scsi device %s:%d:%d.%u not found"), > scsihostsrc->adapter, scsihostsrc->bus, > scsihostsrc->target, scsihostsrc->unit); > } > diff --git a/src/util/virhostdev.c b/src/util/virhostdev.c > index 1c8f31e..ea0076c 100644 > --- a/src/util/virhostdev.c > +++ b/src/util/virhostdev.c > @@ -1482,7 +1482,7 @@ virHostdevReAttachSCSIHostDevices(virHostdevManagerPtr > hostdev_mgr, >scsihostsrc->adapter, scsihostsrc->bus, >scsihostsrc->target, scsihostsrc->unit, >hostdev->readonly, hostdev->shareable))) { > -VIR_WARN("Unable to reattach SCSI device %s:%d:%d:%d on domain %s", > +VIR_WARN("Unable to reattach SCSI device %s:%d:%d:%u on domain %s", > scsihostsrc->adapter, scsihostsrc->bus, scsihostsrc->target, > scsihostsrc->unit, dom_name); > return; > @@ -1492,7 +1492,7 @@ virHostdevReAttachSCSIHostDevices(virHostdevManagerPtr > hostdev_mgr, > * because qemuProcessStart could fail half way through. */ > > if (!(tmp = virSCSIDeviceListFind(hostdev_mgr->activeSCSIHostdevs, > scsi))) { > -VIR_WARN("Unable to find device %s:%d:%d:%d " > +VIR_WARN("Unable to find device %s:%d:%d:%u " > "in list of active SCSI devices", > scsihostsrc->adapter, scsihostsrc->bus, > scsihostsrc->target, scsihostsrc->unit); > @@ -1500,7 +1500,7 @@ virHostdevReAttachSCSIHostDevices(virHostdevManagerPtr > hostdev_mgr, > return; > } > > -VIR_DEBUG("Removing %s:%d:%d:%d dom=%s from activeSCSIHostdevs", > +VIR_DEBUG("Removing %s:%d:%d:%u dom=%s from activeSCSIHostdevs", > scsihostsrc->adapter, scsihostsrc->bus, scsihostsrc->target
[libvirt] [PATCH 2/5] Print SCSI logical unit as unsigned integer
The logical unit field is an unsigned integer, we should use the appropriate substitution when printing it. Signed-off-by: Eric Farman --- src/conf/domain_audit.c | 2 +- src/conf/domain_conf.c | 2 +- src/qemu/qemu_hotplug.c | 4 ++-- src/util/virhostdev.c | 6 +++--- src/util/virscsi.c | 6 +++--- tools/virsh-domain.c| 2 +- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/conf/domain_audit.c b/src/conf/domain_audit.c index 1900039..c94cae8 100644 --- a/src/conf/domain_audit.c +++ b/src/conf/domain_audit.c @@ -427,7 +427,7 @@ virDomainAuditHostdev(virDomainObjPtr vm, virDomainHostdevDefPtr hostdev, } else { virDomainHostdevSubsysSCSIHostPtr scsihostsrc = &scsisrc->u.host; -if (virAsprintfQuiet(&address, "%s:%d:%d:%d", +if (virAsprintfQuiet(&address, "%s:%d:%d:%u", scsihostsrc->adapter, scsihostsrc->bus, scsihostsrc->target, scsihostsrc->unit) < 0) { diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 9e77b87..7e3ca36 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -18940,7 +18940,7 @@ virDomainHostdevDefFormatSubsys(virBufferPtr buf, virBufferAsprintf(buf, "\n", scsihostsrc->adapter); virBufferAsprintf(buf, - "\n", + "\n", includeTypeInAddr ? "type='scsi' " : "", scsihostsrc->bus, scsihostsrc->target, scsihostsrc->unit); diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index cc86a3b..1d538a0 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -1938,7 +1938,7 @@ qemuDomainAttachHostSCSIDevice(virConnectPtr conn, } else { virDomainHostdevSubsysSCSIHostPtr scsihostsrc = &scsisrc->u.host; virReportError(VIR_ERR_INTERNAL_ERROR, - _("Unable to prepare scsi hostdev: %s:%d:%d:%d"), + _("Unable to prepare scsi hostdev: %s:%d:%d:%u"), scsihostsrc->adapter, scsihostsrc->bus, scsihostsrc->target, scsihostsrc->unit); } @@ -3873,7 +3873,7 @@ int qemuDomainDetachHostDevice(virQEMUDriverPtr driver, virDomainHostdevSubsysSCSIHostPtr scsihostsrc = &scsisrc->u.host; virReportError(VIR_ERR_OPERATION_FAILED, -_("host scsi device %s:%d:%d.%d not found"), +_("host scsi device %s:%d:%d.%u not found"), scsihostsrc->adapter, scsihostsrc->bus, scsihostsrc->target, scsihostsrc->unit); } diff --git a/src/util/virhostdev.c b/src/util/virhostdev.c index 1c8f31e..ea0076c 100644 --- a/src/util/virhostdev.c +++ b/src/util/virhostdev.c @@ -1482,7 +1482,7 @@ virHostdevReAttachSCSIHostDevices(virHostdevManagerPtr hostdev_mgr, scsihostsrc->adapter, scsihostsrc->bus, scsihostsrc->target, scsihostsrc->unit, hostdev->readonly, hostdev->shareable))) { -VIR_WARN("Unable to reattach SCSI device %s:%d:%d:%d on domain %s", +VIR_WARN("Unable to reattach SCSI device %s:%d:%d:%u on domain %s", scsihostsrc->adapter, scsihostsrc->bus, scsihostsrc->target, scsihostsrc->unit, dom_name); return; @@ -1492,7 +1492,7 @@ virHostdevReAttachSCSIHostDevices(virHostdevManagerPtr hostdev_mgr, * because qemuProcessStart could fail half way through. */ if (!(tmp = virSCSIDeviceListFind(hostdev_mgr->activeSCSIHostdevs, scsi))) { -VIR_WARN("Unable to find device %s:%d:%d:%d " +VIR_WARN("Unable to find device %s:%d:%d:%u " "in list of active SCSI devices", scsihostsrc->adapter, scsihostsrc->bus, scsihostsrc->target, scsihostsrc->unit); @@ -1500,7 +1500,7 @@ virHostdevReAttachSCSIHostDevices(virHostdevManagerPtr hostdev_mgr, return; } -VIR_DEBUG("Removing %s:%d:%d:%d dom=%s from activeSCSIHostdevs", +VIR_DEBUG("Removing %s:%d:%d:%u dom=%s from activeSCSIHostdevs", scsihostsrc->adapter, scsihostsrc->bus, scsihostsrc->target, scsihostsrc->unit, dom_name); diff --git a/src/util/virscsi.c b/src/util/virscsi.c index 9f5cf0d..6c8b6ce 100644 --- a/src/util/virscsi.c +++ b/src/util/virscsi.c @@ -123,7 +123,7 @@ virSCSIDeviceGetSgName(const char *sysfs_prefix, return NULL; if (virAsprintf(&path, -"%s/%d:%d:%d:%d/scsi_generic", +"%s/%d:%d:%d:%u/scsi_generic",