Пример #1
0
        //---------------------------------------------------------------------------------------------------------------------

        #region APPLIANCE

        /// <summary>Queries the cloud provider to get a list of the cloud appliances created on it.</summary>
        public override CloudAppliance[] FindAppliances(bool detailed)
        {
            List <CloudAppliance> list = new List <CloudAppliance>();
            VM_POOL pool = this.XmlRpc.VMGetPoolInfo(-2, -1, -1, -2);

            foreach (VM vm in pool.VM)
            {
                list.Add(new OneCloudAppliance(context, vm, this));
            }
            return(list.ToArray());
        }
Пример #2
0
        /// \xrefitem rmodp "RM-ODP" "RM-ODP Documentation"
        public List <WpsProvider> GetWPSFromVMs(NameValueCollection parameters = null)
        {
            if (context.UserId == 0)
            {
                return(new List <WpsProvider>());
            }
            if (!(parameters != null && !string.IsNullOrEmpty(parameters["cloud"]) && parameters["cloud"] == "true"))
            {
                return(new List <WpsProvider>());
            }

            List <WpsProvider> result = new List <WpsProvider>();

            try{
                StartDelegate(context.UserId);
                context.LogDebug(this, string.Format("Get VM Pool for user {0}", cloudusername));
                VM_POOL pool = oneClient.VMGetPoolInfo(-2, -1, -1, 3);
                if (pool != null && pool.VM != null)
                {
                    context.LogDebug(this, string.Format("{0} VM found", pool.VM != null ? pool.VM.Length : 0));
                    foreach (VM vm in pool.VM)
                    {
                        if (vm.USER_TEMPLATE == null)
                        {
                            continue;
                        }
                        try{
                            var wps = CreateWpsProviderForOne(context, vm, parameters);
                            if (wps != null)
                            {
                                if (parameters != null && (!string.IsNullOrEmpty(parameters["uid"]) || !string.IsNullOrEmpty(parameters["id"])))
                                {
                                    var uid = !string.IsNullOrEmpty(parameters["uid"]) ? parameters["uid"] : parameters["id"];
                                    if (uid == wps.Identifier)
                                    {
                                        result.Add(wps);
                                    }
                                }
                                else
                                {
                                    result.Add(wps);
                                }
                            }
                        }catch (Exception) {
                        }
                    }
                }
            }catch (System.Net.WebException) {
            }
            return(result);
        }