Re: [PATCH v3] conf: Generate address for scsi host device automatically

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

 



On 03/06/13 22:15, Viktor Mihajlovski wrote:
On 05/31/2013 12:09 PM, Osier Yang wrote:
+
+static int
+virDomainHostdevAssignAddress(virDomainXMLOptionPtr xmlopt,
+                              virDomainDefPtr def,
+                              virDomainHostdevDefPtr hostdev)
+{
+    int next_unit;
+    unsigned nscsi_controllers = 0;
+    bool found = false;
+    int i;
+
+ if (hostdev->source.subsys.type != VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI)
+        return -1;
+
+    for (i = 0; i < def->ncontrollers && !found; i++) {
+ if (def->controllers[i]->type != VIR_DOMAIN_CONTROLLER_TYPE_SCSI)
+            continue;
+
+        nscsi_controllers++;
+        next_unit = virDomainControllerSCSINextUnit(def,
+ xmlopt->config.hasWideScsiBus ?
+ SCSI_WIDE_BUS_MAX_CONT_UNIT :
+ SCSI_NARROW_BUS_MAX_CONT_UNIT,
+ def->controllers[i]->idx);
+        if (next_unit >= 0)
+            found = true;
+    }
+
+    hostdev->info->type = VIR_DOMAIN_DEVICE_ADDRESS_TYPE_DRIVE;
+
+    hostdev->info->addr.drive.controller = found ?
+ def->controllers[i - 1]->idx :
+                                           nscsi_controllers;
+    hostdev->info->addr.drive.bus = 0;
+    hostdev->info->addr.drive.target = 0;
+    hostdev->info->addr.drive.unit = found ? next_unit : 0;
well, 1.0.6 is out of the door, but with this I hit the following
problem on Ubuntu 12.04 (gcc 4.6.3):
../../src/conf/domain_conf.c: In function 'virDomainHostdevDefParseXML':
../../src/conf/domain_conf.c:3915:36: error: 'next_unit' may be used uninitialized in this function [-Werror=uninitialized]
../../src/conf/domain_conf.c:3886:9: note: 'next_unit' was declared here

It seems that the older compiler is not smart enough to grasp the tie
between 'found' and 'next_unit'...

fixed by Jirka with 4db39e3fee6


+
+    return 0;
+}



--
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]