Example #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);
            }
        }
Example #2
0
        public override void ExecuteCmdlet()
        {
            try
            {
                var confirmMigrationRequest = new MigrationConfirmStatusRequest();
                confirmMigrationRequest.Operation =
                    (MigrationOperation)Enum.Parse(typeof(MigrationOperation), MigrationOperation, true);
                switch (ParameterSetName)
                {
                case StorSimpleCmdletParameterSet.MigrateAllContainer:
                {
                    confirmMigrationRequest.DataContainerNameList = new List <string>();
                    break;
                }

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

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

                var status = StorSimpleClient.ConfirmLegacyVolumeContainerStatus(LegacyConfigId, confirmMigrationRequest);
                MigrationCommonModelFormatter opFormatter = new MigrationCommonModelFormatter();
                WriteObject(opFormatter.GetResultMessage(Resources.ConfirmMigrationSuccessMessage, status));
            }
            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);
            }
        }