//--------------------------------------------------------------------------------------------------------------------- public static LocalCloudAppliance FromResources(IfyContext context, OneVMTemplate template, OneImage[] storages, OneNetwork network) { LocalCloudAppliance result = new LocalCloudAppliance(context); result.VMTemplate = template; result.Images = storages; result.Network = network; return(result); }
//--------------------------------------------------------------------------------------------------------------------- public static CloudAppliance FromOneXmlTemplate(IfyContext context, string sbXmlTemplate) { LocalCloudAppliance result = new LocalCloudAppliance(context); // One of the parameter is a base64 xml template from opennebula XmlDocument sbXmlDoc = new XmlDocument(); sbXmlDoc.LoadXml(sbXmlTemplate); result.Name = sbXmlDoc.SelectSingleNode("/VM/NAME").InnerText; result.RemoteId = sbXmlDoc.SelectSingleNode("/VM/ID").InnerText; XmlNode itnode = sbXmlDoc.SelectSingleNode("/VM/TEMPLATE/INSTANCE_TYPE"); result.Network = new OneNetwork(context); result.Network.IpAddress = GetLocalIPAddress(); result.State = MachineState.Active; result.StatusText = "ACTIVE"; return(result); }