Exemple #1
0
        public override void ExecuteCmdlet()
        {
            try
            {
                var importDataContainerRequest = new MigrationImportDataContainerRequest();
                switch (ParameterSetName)
                {
                case StorSimpleCmdletParameterSet.MigrateAllContainer:
                {
                    importDataContainerRequest.DataContainerNames = new List <string>();
                    break;
                }

                case StorSimpleCmdletParameterSet.MigrateSpecificContainer:
                {
                    importDataContainerRequest.DataContainerNames =
                        new List <string>(LegacyContainerNames.ToList().Distinct(
                                              StringComparer.InvariantCultureIgnoreCase));
                    break;
                }

                default:
                {
                    // unexpected code path.
                    throw new ParameterBindingException(
                              string.Format(Resources.MigrationParameterSetNotFound, ParameterSetName));
                }
                }

                importDataContainerRequest.ForceOnOtherDevice = Force.IsPresent;
                importDataContainerRequest.SkipACRs           = SkipACRs.IsPresent;

                var migrationJobStatus = StorSimpleClient.MigrationImportDataContainer(LegacyConfigId,
                                                                                       importDataContainerRequest);
                MigrationCommonModelFormatter opFormatter = new MigrationCommonModelFormatter();
                WriteObject(opFormatter.GetResultMessage(Resources.MigrationImportDataContainerSuccessMessage,
                                                         migrationJobStatus));
            }
            catch (Exception except)
            {
                this.HandleException(except);
            }
        }
        public override void ExecuteCmdlet()
        {
            try
            {
                var importDataContainerRequest = new MigrationImportDataContainerRequest();
                importDataContainerRequest.DataContainerNames = (null != LegacyContainerNames)
                    ? new List <string>(LegacyContainerNames.ToList().Distinct(StringComparer.InvariantCultureIgnoreCase))
                    : new List <string>();
                importDataContainerRequest.ForceOnOtherDevice = Force.IsPresent;
                importDataContainerRequest.SkipACRs           = SkipACRs.IsPresent;

                var migrationJobStatus = StorSimpleClient.MigrationImportDataContainer(LegacyConfigId,
                                                                                       importDataContainerRequest);
                MigrationCommonModelFormatter opFormatter = new MigrationCommonModelFormatter();
                WriteObject(opFormatter.GetResultMessage(Resources.MigrationImportDataContainerSuccessMessage,
                                                         migrationJobStatus));
            }
            catch (Exception except)
            {
                this.HandleException(except);
            }
        }