Exemplo n.º 1
0
        //---------------------------------------------------------------------------------------------------------------------

        /// <summary>
        /// Creates the instance.
        /// </summary>
        /// <returns>The instance.</returns>
        /// <param name="name">Name.</param>
        /// <param name="templateName">Template name.</param>
        /// <param name="networkName">Network name.</param>
        /// <param name="additionalTemplate">Additional template, value should be XML</param>
        public override CloudAppliance CreateInstance(string name, string templateName, string networkName, List <KeyValuePair <string, string> > additionalTemplate)
        {
            OneVMTemplate template    = (OneVMTemplate)this.GetTemplate(templateName);
            string        templatexml = "";

            foreach (KeyValuePair <string, string> kvp in additionalTemplate)
            {
                string xml = template.GetTemplateXml(kvp.Key);
                if (xml != null)
                {
                    templatexml += "<" + kvp.Key + ">" + xml + kvp.Value + "</" + kvp.Key + ">";
                }
            }
            if (templatexml == "")
            {
                template.AdditionalContent = "";
            }
            else
            {
                template.AdditionalContent = "<TEMPLATE>" + templatexml + "</TEMPLATE>";
            }
            OneImage[] disks   = new OneImage[0];
            OneNetwork network = (networkName != null && networkName != "" ? (OneNetwork)this.GetNetwork(networkName) : null);

            return(CreateInstance(name, template, disks, network));
        }
Exemplo n.º 2
0
        //---------------------------------------------------------------------------------------------------------------------

        public override CloudAppliance CreateInstance(string name, string templateName, string networkName)
        {
            OneVMTemplate template = (OneVMTemplate)this.GetTemplate(templateName);

            OneImage[] disks   = new OneImage[0];
            OneNetwork network = (networkName != null && networkName != "" ? (OneNetwork)this.GetNetwork(networkName) : null);

            return(CreateInstance(name, template, disks, network));
        }
Exemplo n.º 3
0
        //---------------------------------------------------------------------------------------------------------------------

        public override CloudAppliance CreateInstance(string name, string templateName, string[] diskNames, string networkName)
        {
            OneVMTemplate template = (OneVMTemplate)this.GetTemplate(templateName);

            OneImage[] disks = new OneImage[diskNames.Length];
            for (int i = 0; i < diskNames.Length; i++)
            {
                disks[i] = (OneImage)this.GetImage(diskNames[i]);
            }
            OneNetwork network = (networkName != null ? (OneNetwork)this.GetNetwork(networkName) : null);

            return(CreateInstance(name, template, disks, network));
        }
Exemplo n.º 4
0
        //---------------------------------------------------------------------------------------------------------------------

        public static OneCloudAppliance FromResources(IfyContext context, OneVMTemplate template, OneImage[] storages, OneNetwork network)
        {
            OneCloudAppliance result = new OneCloudAppliance(context);

            result.VMTemplate = template;
            result.Images     = storages;
            result.Network    = network;
            return(result);
        }