Ján Tomko wrote:
On 03/20/2014 04:01 PM, Daniel P. Berrange wrote:
> On Wed, Mar 19, 2014 at 04:52:33PM +0100, Ján Tomko wrote:
>> ---
>> tests/viriscsitest.c | 82 ++++++++++++++++++++++++++++++++++++++++++++++++++++
>> 1 file changed, 82 insertions(+)
>>
>> diff --git a/tests/viriscsitest.c b/tests/viriscsitest.c
>> index 0b09834..16a40c7 100644
>> --- a/tests/viriscsitest.c
>> +++ b/tests/viriscsitest.c
>> @@ -51,6 +51,14 @@ static const char *iscsiadmSessionOutputNonFlash =
>> "tcp: [6] 10.20.30.44:3260,1 iqn.2008-04.example:example1:iscsi.bar
(non-flash)\n"
>> "tcp: [7] 10.20.30.45:3260,1 iqn.2009-04.example:example1:iscsi.seven
(non-flash)\n";
>>
>> +const char *iscsiadmSendtargetsOutput =
>> +"10.20.30.40:3260,1 iqn.2004-06.example:example1:iscsi.test\n"
>> +"10.20.30.40:3260,1 iqn.2005-05.example:example1:iscsi.hello\n"
>> +"10.20.30.40:3260,1 iqn.2006-04.example:example1:iscsi.world\n"
>> +"10.20.30.40:3260,1 iqn.2007-04.example:example1:iscsi.foo\n"
>> +"10.20.30.40:3260,1 iqn.2008-04.example:example1:iscsi.bar\n"
>> +"10.20.30.40:3260,1 iqn.2009-04.example:example1:iscsi.seven\n";
>
> Same note about indenting the strings relative to the variable dcl.
>
>> +
>> struct testSessionInfo {
>> const char *device_path;
>> int output_version;
>> @@ -74,6 +82,15 @@ static void testIscsiadmCb(const char *const*args,
>> ignore_value(VIR_STRDUP(*output, iscsiadmSessionOutputNonFlash));
>> else
>> ignore_value(VIR_STRDUP(*output, iscsiadmSessionOutput));
>> + } else if (args[0] && STREQ(args[0], ISCSIADM) &&
>> + args[1] && STREQ(args[1], "--mode")
&&
>> + args[2] && STREQ(args[2], "discovery")
&&
>> + args[3] && STREQ(args[3], "--type")
&&
>> + args[4] && STREQ(args[4], "sendtargets")
&&
>> + args[5] && STREQ(args[5], "--portal")
&&
>> + args[6] && STREQ(args[6],
"10.20.30.40:3260,1") &&
>> + args[7] == NULL) {
>
> I find myself doing a similar with to compare args. I wonder if we
> should create a virStringListIsEqual() helper function for comparing
> a char ** against a statically declared args list.
>
> ACK because such a refactoring can be separately done any time.
>
I've added ATTRIBUTEs to function declarations in viriscsi.h, indented the
const strings and pushed the series, thank you for the reviews!
This breaks the build without iscsi backend:
gmake[3]: Entering directory `/usr/home/novel/code/libvirt/src'
CC util/libvirt_util_la-viriscsi.lo
util/viriscsi.c:83:46: error: use of undeclared identifier 'ISCSIADM'
virCommandPtr cmd = virCommandNewArgList(ISCSIADM, "--mode",
"session", NULL);
^
util/viriscsi.c:119:46: error: use of undeclared identifier 'ISCSIADM'
virCommandPtr cmd = virCommandNewArgList(ISCSIADM,
and other similar errors because of ISCSIADM is not defined.
Should these files go into STORAGE_DRIVER_ISCSI_SOURCES or UTIL_SOURCES needs to be
adjusted depending if we want iscsi backend or not?
Roman Bogorodskiy