Beispiel #1
0
        /// <summary>
        /// Gets information about the LUNs available from the Target.
        /// </summary>
        /// <returns>The LUNs available</returns>
        public LunInfo[] GetLuns()
        {
            ScsiReportLunsCommand cmd = new ScsiReportLunsCommand(ScsiReportLunsCommand.InitialResponseSize);

            ScsiReportLunsResponse resp = Send <ScsiReportLunsResponse>(cmd, null, 0, 0, ScsiReportLunsCommand.InitialResponseSize);

            if (resp.Truncated)
            {
                cmd  = new ScsiReportLunsCommand(resp.NeededDataLength);
                resp = Send <ScsiReportLunsResponse>(cmd, null, 0, 0, (int)resp.NeededDataLength);
            }

            if (resp.Truncated)
            {
                throw new InvalidProtocolException("Truncated response");
            }

            LunInfo[] result = new LunInfo[resp.Luns.Count];
            for (int i = 0; i < resp.Luns.Count; ++i)
            {
                result[i] = GetInfo((long)resp.Luns[i]);
            }

            return(result);
        }
Beispiel #2
0
        public override void Connect(Uri uri, string username, string password)
        {
            _lunInfo = LunInfo.ParseUri(uri.OriginalString);

            Initiator initiator = new Initiator();

            initiator.SetCredentials(username, password);
            _session = initiator.ConnectTo(_lunInfo.Target);
        }