//---------------------------------------------------------------------------------------------------------------------

        public override CloudAppliance CreateInstance(string caption, VirtualMachineTemplate template, VirtualDisk[] disks, VirtualNetwork network)
        {
            return(null);
        }
Exemple #2
0
        //---------------------------------------------------------------------------------------------------------------------

        public override CloudAppliance CreateInstance(string name, VirtualMachineTemplate template, VirtualDisk[] disks, VirtualNetwork network)
        {
            OneCloudAppliance appliance = OneCloudAppliance.FromResources(context, template as OneVMTemplate, disks as OneImage[], network as OneNetwork);

            appliance.XmlRpcProvider     = this;
            appliance.Name               = name;
            appliance.AdditionalTemplate = template.AdditionalContent;

            //delegate client user
            CloudUser owner = CloudUser.FromIdAndProvider(context, context.OwnerId, this.Id);

            this.StartDelegate(owner.CloudUsername);
            appliance.Create();
            this.EndDelegate();

            foreach (OneImage disk in disks)
            {
                this.XmlRpc.VMAttachDisk(Int32.Parse(appliance.Vm.ID), "<TEMPLATE><DISK><IMAGE_ID>" + disk.RemoteId + "</IMAGE_ID></DISK></TEMPLATE>");
            }

            return(appliance);
        }
        //---------------------------------------------------------------------------------------------------------------------

        public abstract CloudAppliance CreateInstance(string caption, VirtualMachineTemplate template, VirtualDisk[] disks, VirtualNetwork network);
        //---------------------------------------------------------------------------------------------------------------------

        public override CloudAppliance CreateInstance(string name, VirtualMachineTemplate template, VirtualDisk[] disks, VirtualNetwork network)
        {
            CloudAppliance appliance = OcciCloudAppliance.FromResources(context, template as OcciInstanceType, disks as OcciStorage[], network as OcciNetwork);

            appliance.Name = name;
            appliance.Create();
            return(appliance);
        }