예제 #1
0
        public async Task <int> CreateDisks(VmTemplate template)
        {
            if (template.Disks.Length == 0)
            {
                return(-1);
            }

            int progress = await VerifyDisks(template);

            if (progress < 0)
            {
                VimClient host = FindHostByRandom();
                if (template.Disks[0].Source.HasValue())
                {
                    Task cloneTask = host.CloneDisk(template.Id, template.Disks[0].Source, template.Disks[0].Path);
                    progress = 0;
                }
                else
                {
                    await host.CreateDisk(template.Disks[0]);

                    progress = 100;
                }
            }
            return(progress);
        }