Esempio n. 1
0
 /// <summary>
 /// Gets the LUN as a string.
 /// </summary>
 /// <returns>The LUN in string form.</returns>
 public override string ToString()
 {
     if (((ulong)Lun & 0xFF00000000000000) == 0)
     {
         return((Lun >> (6 * 8)).ToString(CultureInfo.InvariantCulture));
     }
     return(Lun.ToString(CultureInfo.InvariantCulture));
 }
Esempio n. 2
0
        /// <summary>
        /// Performs execution of the command
        /// </summary>
        protected override void ProcessRecord()
        {
            try
            {
                CreateLunInput input = new CreateLunInput();

                if (ParameterPresent("Server"))
                {
                    input.HostGuids = new Guid[] { Server.Guid }
                }
                ;

                if (ParameterPresent("Spu"))
                {
                    input.SpuSerials = new string[] { Spu.Serial }
                }
                ;

                if (ParameterPresent("Volume"))
                {
                    input.VolumeGuid = Volume.Guid;
                }

                if (ParameterPresent("LunId"))
                {
                    input.LunId = LunId;
                }

                input.Local = Local.IsPresent;

                Lun newLun = Connection.CreateLun(input);

                WriteObject(newLun);
            }
            catch (AggregateException exceptions)
            {
                foreach (Exception ex in exceptions.InnerExceptions)
                {
                    WriteError(ex);
                }
            }
            catch (Exception ex)
            {
                WriteError(ex);
            }
        }