Example #1
0
        private async Task <List <RestartInfo?> > CopyAliensFromNode(NodeWithDirs node, List <NodeWithDirs> nodes, Configuration config)
        {
            var result = new List <RestartInfo?>();

            var client = new BobApiClient(node.Uri);
            var disks  = await client.GetDisksToMonitor();

            var alienDisk = disks.FirstOrDefault(d => d.Path == node.AlienDir.Path).Name;

            if (alienDisk == null)
            {
                return(result);
            }

            await client.StopDisk(alienDisk);

            await client.StartDisk(alienDisk);

            var tasks = new List <Task <RestartInfo?[]> >();

            foreach (var alienNode in node.AlienDir.Nodes)
            {
                tasks.Add(CopyAlien(alienNode, nodes, config));
            }
            return(await Task.WhenAll(tasks).ContinueWith(t => t.Result.SelectMany(_ => _).ToList()));
        }
Example #2
0
        public async Task <IEnumerable <BobDisk> > GenerateConfigFromBob(BobApiClient bobApiClient)
        {
            var disks = await bobApiClient.GetDisksToMonitor();

            if (disks == null)
            {
                logger.LogError($"Failed to get bob disks from {bobApiClient}");
                return(Enumerable.Empty <BobDisk>());
            }
            var physicalDisks = await disksFinder.FindDisks();

            var infos = disks.Where(d => d.IsActive).Select(d => FindInfo(d, physicalDisks)).Where(i => i != null);

            return(infos);
        }