/// <summary>
        /// Triggers clone operation on a iscsiserver for given backupset
        /// </summary>
        /// <param name="backupSet"></param>
        /// <param name="deviceName"></param>
        /// <param name="isciServer"></param>
        /// <param name="backupElementName"></param>
        /// <param name="endPointName"></param>
        public static void Clone(
            this Backup backupSet,
            string deviceName,
            ISCSIServer isciServer,
            string backupElementName,
            string endPointName)
        {
            var device = backupSet.Client.Devices.Get(
                deviceName,
                backupSet.ResourceGroupName,
                backupSet.ManagerName);

            Assert.True(
                device != null,
                "no matching device found with name:" + deviceName);

            Assert.True(
                isciServer != null,
                "iscsiServer param is null");

            var restoreIscsiDisk = new ISCSIDisk(
                backupSet.Client,
                backupSet.ResourceGroupName,
                backupSet.ManagerName,
                endPointName);

            restoreIscsiDisk.Initialize(DataPolicy.Tiered);
            restoreIscsiDisk.Description = "Restore Disk ";

            var cloneRequest = new CloneRequest()
            {
                NewEndpointName     = endPointName,
                TargetAccessPointId = isciServer.Id,
                TargetDeviceId      = device.Id,
                Disk = restoreIscsiDisk
            };

            backupSet.Client.Backups.Clone(
                device.Name.GetDoubleEncoded(),
                backupSet.Name.GetDoubleEncoded(),
                backupElementName,
                cloneRequest,
                backupSet.ResourceGroupName,
                backupSet.ManagerName);
        }
        /// <summary>
        /// Returns disks from a given iscsiserver on a device
        /// </summary>
        /// <param name="iscsiServer"></param>
        /// <param name="deviceName"></param>
        /// <returns></returns>
        public static IEnumerable <ISCSIDisk> GetIscsiDisks(
            this ISCSIServer iscsiServer,
            string deviceName)
        {
            var iscsiDisks = iscsiServer.Client.IscsiDisks.ListByIscsiServer(
                deviceName.GetDoubleEncoded(),
                iscsiServer.Name.GetDoubleEncoded(),
                iscsiServer.ResourceGroupName,
                iscsiServer.ManagerName);

            if (iscsiDisks == null || !iscsiDisks.Any())
            {
                // Create a IscsiDisk with Tiered data policy
                var iscsiDisktoCreate = new ISCSIDisk(
                    iscsiServer.Client,
                    iscsiServer.ResourceGroupName,
                    iscsiServer.ManagerName,
                    TestConstants.DefaultTieredIscsiDiskName);
                iscsiDisktoCreate.Initialize(DataPolicy.Tiered);

                var iscsiDisk = iscsiDisktoCreate.CreateOrUpdate(
                    iscsiServer.Name,
                    iscsiServer.Name);
            }

            iscsiDisks = iscsiServer.Client.IscsiDisks.ListByIscsiServer(
                deviceName.GetDoubleEncoded(),
                iscsiServer.Name.GetDoubleEncoded(),
                iscsiServer.ResourceGroupName,
                iscsiServer.ManagerName);

            foreach (var iscsiDisk in iscsiDisks)
            {
                iscsiDisk.SetBaseResourceValues(
                    iscsiServer.Client,
                    iscsiServer.ResourceGroupName,
                    iscsiServer.ManagerName);
            }

            return(iscsiDisks);
        }
        public void TestCreateOrUpdateIscsiDisk()
        {
            try
            {
                var iSCSIServers = TestUtilities.GetIscsiServers(
                    this.Client,
                    this.ResourceGroupName,
                    this.ManagerName);

                Assert.True(
                    iSCSIServers != null && iSCSIServers.Any(),
                    $"No iscsiservers were found in the manger {this.ManagerName}");

                // Select the first iscsiserver
                var iscsiServer = iSCSIServers.First();

                // Create a iscsidisk with Tiered data policy
                var iscsiDisk = new ISCSIDisk(
                    this.Client,
                    this.ResourceGroupName,
                    this.ManagerName,
                    "Auto-TestIscsiDisk1");
                iscsiDisk.Initialize(DataPolicy.Tiered);

                var iscsiDiskCreated = iscsiDisk.CreateOrUpdate(
                    iscsiServer.Name,
                    iscsiServer.Name);

                // Create a iscsidisk with tiered data policy
                var iscsiDisk2 = new ISCSIDisk(
                    this.Client,
                    this.ResourceGroupName,
                    this.ManagerName,
                    "Auto-TestIscsiDisk2");
                iscsiDisk2.Initialize(DataPolicy.Tiered);

                var iscsiDiskCreated2 = iscsiDisk2.CreateOrUpdate(
                    iscsiServer.Name,
                    iscsiServer.Name);

                // Update Description and ShareStatus
                iscsiDiskCreated.Description = "Updated: " + iscsiDiskCreated.Description;
                iscsiDiskCreated.DiskStatus  = DiskStatus.Offline;
                iscsiDiskCreated             = iscsiDiskCreated.CreateOrUpdate(
                    iscsiServer.Name,
                    iscsiServer.Name);

                // Validate iscsi disks by Managers
                var iscsiDisksByIscsiServer = this.Client.IscsiDisks.ListByIscsiServer(
                    iscsiServer.Name,
                    iscsiServer.Name,
                    this.ResourceGroupName,
                    this.ManagerName);

                var iscsiDisksByDevice = this.Client.IscsiDisks.ListByDevice(
                    iscsiServer.Name,
                    this.ResourceGroupName,
                    this.ManagerName);
            }
            catch (Exception e)
            {
                Assert.Null(e);
            }
            #endregion Test methods
        }