示例#1
0
        private async Task DeleteVdAsync(VirtualDisk volume)
        {
            try
            {
                var      idrac = new StorageController(server);
                IdracJob job   = await idrac.DeleteVirtualDiskAsync(volume);

                var load = new LoadWindow(server, job)
                {
                    Title = server.Host
                };
                load.Closed += (object sender, EventArgs e) =>
                {
                    var window = (LoadWindow)sender;
                    job = window.Job;
                    if (job.JobState.Contains("Completed"))
                    {
                        MessageBox.Show("Volume excluido com sucesso !", "Sucesso", MessageBoxButton.OK, MessageBoxImage.Information);
                    }
                };
                load.Show();
            }
            catch (Exception ex)
            {
                MessageBox.Show(string.Format("Falha ao criar o Job {0}", ex.Message), "Erro", MessageBoxButton.OK, MessageBoxImage.Error);
            }
            UpdateForm();
        }
示例#2
0
 private async Task CollectAsync(Server server, string type)
 {
     try
     {
         OutputTextBox.AppendText(string.Format("Coletando Logs de {0}...\n", server.Host));
         string             collectCommand = string.Format("racadm techsupreport collect -t {0}", type);
         IdracSshController idrac          = new IdracSshController(server);
         string             result         = idrac.RunCommand(collectCommand);
         string             jobLine        = result.Split('\n').FirstOrDefault();
         string             jobId          = jobLine.Split('=')[1].Trim();
         IdracJob           job            = await new JobController(server).GetJobAsync(jobId);
         var load = new LoadWindow(server, job)
         {
             Title = server.Host
         };
         load.Closed += (object sender, EventArgs e) =>
         {
             var window = (LoadWindow)sender;
             job = window.Job;
             if (job.JobState.Contains("Completed"))
             {
                 ExportTsr(server);
             }
         };
         load.Show();
     }
     catch (Exception ex)
     {
         OutputTextBox.AppendText(string.Format("Falha ao coletar TSR de {0}, {1}\n", server.Host, ex.Message));
     }
 }
示例#3
0
        public async void CreateRaidAsync(List <PhysicalDisk> disks, Enclousure enclousure, string level, string name, long capacity, long optimal)
        {
            try
            {
                var      idrac = new StorageController(server);
                IdracJob job   = await idrac.CreateVirtualDiskAsync(disks, enclousure, level, capacity, optimal, name);

                var load = new LoadWindow(server, job)
                {
                    Title = server.Host
                };
                load.Closed += (object sender, EventArgs e) =>
                {
                    var window = (LoadWindow)sender;
                    job = window.Job;
                    if (job.JobState.Contains("Completed"))
                    {
                        MessageBox.Show("Raid criado com sucesso !", "Sucesso", MessageBoxButton.OK, MessageBoxImage.Information);
                    }
                };
                load.Show();
            }
            catch (Exception ex)
            {
                MessageBox.Show(string.Format("Falha ao criar o Job {0}", ex.Message), "Erro", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
示例#4
0
        private async Task ExportScpFileAsync(Server server, string target, string exportUse)
        {
            if (!await NetworkHelper.CheckConnectionAsync(server.Host))
            {
                MessageBox.Show("Servidor inacessivel", "Erro", MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }
            try
            {
                ScpController idrac = new ScpController(server);
                ExportButton.IsEnabled = false;
                OutputTextBox.AppendText(string.Format("Exportando configurações de {0}...\n", server.Host));
                IdracJob job = await idrac.ExportScpFileAsync(target, exportUse);

                var load = new LoadWindow(server, job)
                {
                    Title = server.Host
                };
                load.Closed += async(object sender, EventArgs e) =>
                {
                    var window = (LoadWindow)sender;
                    job = window.Job;
                    if (job.JobState.Contains("Completed"))
                    {
                        await SaveFileAsync(server, job);
                    }
                };
                load.Show();
            }
            catch (Exception ex)
            {
                OutputTextBox.AppendText(string.Format("Falha ao exportar arquivo: {0}\n", ex.Message));
                ExportButton.IsEnabled = true;
            }
        }