Ejemplo n.º 1
0
        public List <VM> GetFateSharingVMs()
        {
            //find VMs that do not belong in this appliance
            var vmsNotInCurApp = from VM vm in this.Connection.Cache.VMs
                                 where vm.appliance != this.opaque_ref
                                 select vm;

            var fateSharingVms = new List <VM>();

            foreach (var vmRef in this.VMs)
            {
                VM thisVm = this.Connection.Resolve(vmRef);
                if (thisVm == null)
                {
                    continue;
                }

                foreach (var otherVm in vmsNotInCurApp)
                {
                    if (otherVm.is_a_real_vm() && otherVm.power_state != vm_power_state.Halted && otherVm.SRs().Intersect(thisVm.SRs()).FirstOrDefault() != null && !fateSharingVms.Contains(otherVm))
                    {
                        fateSharingVms.Add(otherVm);
                    }
                }
            }

            return(fateSharingVms);
        }