Esempio n. 1
0
        public HttpResponse AttachDiskToVM(VhdInfo vhdInfo, string serviceName, string deploymentName, string roleName)
        {
            var url = string.Format(URLTEMPLATE_ATTACHDISK, _Connection.SubcriptionID, serviceName, deploymentName, roleName);
            string body = null;


            if (null != vhdInfo.SourceMediaLink)
            {
                body = string.Copy(BODYTEMPLATE_ATTACHBLOB);
                body = body.Replace("{DiskLabel}", vhdInfo.DiskLabel);
                body = body.Replace("{Lun}", vhdInfo.Lun.ToString());
                body = body.Replace("{SourceMediaLink}", vhdInfo.SourceMediaLink);
            }

            if (null != vhdInfo.DiskName)
            {
                body = string.Copy(BODYTEMPLATE_ATTACHDISK);
                body = body.Replace("{DiskLabel}", vhdInfo.DiskLabel);
                body = body.Replace("{Lun}", vhdInfo.Lun.ToString());
                body = body.Replace("{DiskName}", vhdInfo.DiskName);
                body = body.Replace("{MediaLink}", vhdInfo.MediaLink);
                body = body.Replace("{LogicalDiskSizeInGB}", "1");
            }

            var hi = new HttpInterface(_Connection);
            return hi.PerformRequest(HttpInterface.RequestType_Enum.POST, url, body);
        }
Esempio n. 2
0
        //*********************************************************************
        ///
        /// <summary>
        ///     This method attaches a disk to a given VM.
        /// </summary>
        /// <param name="cmpRequestId"></param>
        /// <param name="disk"></param>
        ///
        //*********************************************************************

        public void AttachExistingDisk(int?cmpRequestId, VhdInfo disk)
        {
            var cmp = CmpSvProxy;

            cmp.AttachExistingDisk(cmpRequestId, disk);
        }
Esempio n. 3
0
        //*********************************************************************
        ///
        /// <summary>
        ///     This method is used to detach a disk from a VM
        /// </summary>
        /// <param name="cmpRequestId"></param>
        /// <param name="disk"></param>
        /// <param name="deleteFromStorage"></param>
        ///
        //*********************************************************************

        public void DetachDisk(int?cmpRequestId, VhdInfo disk, bool deleteFromStorage)
        {
            var cmp = CmpSvProxy;

            cmp.DetachDisk(cmpRequestId, disk, deleteFromStorage);
        }