예제 #1
0
        public async Task <IEnumerable <InstanceDto> > GetRunningInstancesAsync()
        {
            ProxmoxApi.ProxmoxApi api = new ProxmoxApi.ProxmoxApi();
            api.Login(_server, UInt32.Parse(_port), _username, _password, _realm);

            var instanceDtos = api.ListVm(_node).Where(i => i.Status == "running").Select(i => new InstanceDto
            {
                HostId  = Id,
                Id      = i.VmId,
                ImageId = "name",
                Status  = i.Status
            });

            return(instanceDtos);
        }
예제 #2
0
        public async Task <IEnumerable <ImageDto> > GetAvailableImagesAsync()
        {
            ProxmoxApi.ProxmoxApi api = new ProxmoxApi.ProxmoxApi();
            api.Login(_server, UInt32.Parse(_port), _username, _password, _realm);

            var images = api.ListVm(_node).Select(i => new ImageDto {
                HostId       = Id,
                Id           = i.VmId,
                Name         = "name",
                Description  = "CPUs: " + i.Cpus + " Status: " + i.Status,
                Capabilities = new List <string>()
            });

            return(images);
        }