예제 #1
0
 public static IEnumerable <IVdsVolume> GetVolumes(this IVdsService vdsService)
 {
     foreach (var pack in vdsService.GetPacks())
     {
         IEnumVdsObject volumeEnum;
         pack.QueryVolumes(out volumeEnum);
         object iface;
         int    fetched;
         while (0 == volumeEnum.Next(1, out iface, out fetched))
         {
             yield return(iface as IVdsVolume);
         }
     }
 }
예제 #2
0
        public static IEnumerable <IVdsDisk> GetDisks(this IVdsService vdsService)
        {
            foreach (var pack in vdsService.GetPacks())
            {
                IEnumVdsObject diskEnum;
                Marshal.ThrowExceptionForHR(pack.QueryDisks(out diskEnum));
                object iface;
                int    fetched;

                while (0 == diskEnum.Next(1, out iface, out fetched))
                {
                    yield return(iface as IVdsDisk);
                }
            }
        }