[libvirt] [PATCH 2/5] Print SCSI logical unit as unsigned integer

Eric Farman farman at linux.vnet.ibm.com
Wed Jun 17 03:29:52 UTC 2015


The logical unit field is an unsigned integer, we should
use the appropriate substitution when printing it.

Signed-off-by: Eric Farman <farman at linux.vnet.ibm.com>
---
 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, "<adapter name='%s'/>\n",
                               scsihostsrc->adapter);
             virBufferAsprintf(buf,
-                              "<address %sbus='%d' target='%d' unit='%d'/>\n",
+                              "<address %sbus='%d' target='%d' 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,
                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",
                     prefix, adapter_id, bus, target, unit) < 0)
         return NULL;
 
@@ -170,7 +170,7 @@ virSCSIDeviceGetDevName(const char *sysfs_prefix,
         return NULL;
 
     if (virAsprintf(&path,
-                    "%s/%d:%d:%d:%d/block",
+                    "%s/%d:%d:%d:%u/block",
                     prefix, adapter_id, bus, target, unit) < 0)
         return NULL;
 
@@ -227,7 +227,7 @@ virSCSIDeviceNew(const char *sysfs_prefix,
     if (virSCSIDeviceGetAdapterId(adapter, &dev->adapter) < 0)
         goto cleanup;
 
-    if (virAsprintf(&dev->name, "%d:%d:%d:%d", dev->adapter,
+    if (virAsprintf(&dev->name, "%d:%d:%d:%u", dev->adapter,
                     dev->bus, dev->target, dev->unit) < 0 ||
         virAsprintf(&dev->sg_path, "%s/%s",
                     sysfs_prefix ? sysfs_prefix : "/dev", sg) < 0)
diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index 0bea462..e9dbcd9 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -725,7 +725,7 @@ cmdAttachDisk(vshControl *ctl, const vshCmd *cmd)
             if (diskAddr.type == DISK_ADDR_TYPE_SCSI) {
                 virBufferAsprintf(&buf,
                                   "<address type='drive' controller='%d'"
-                                  " bus='%d' unit='%d' />\n",
+                                  " bus='%d' unit='%u' />\n",
                                   diskAddr.addr.scsi.controller, diskAddr.addr.scsi.bus,
                                   diskAddr.addr.scsi.unit);
             } else {
-- 
1.9.1




More information about the libvir-list mailing list