2023-01-24 15:29:31 +01:00
|
|
|
|
/* Copyright (c) Cloud Software Group, Inc.
|
2013-06-24 13:41:48 +02:00
|
|
|
|
*
|
|
|
|
|
* Redistribution and use in source and binary forms,
|
|
|
|
|
* with or without modification, are permitted provided
|
|
|
|
|
* that the following conditions are met:
|
|
|
|
|
*
|
|
|
|
|
* * Redistributions of source code must retain the above
|
|
|
|
|
* copyright notice, this list of conditions and the
|
|
|
|
|
* following disclaimer.
|
|
|
|
|
* * Redistributions in binary form must reproduce the above
|
|
|
|
|
* copyright notice, this list of conditions and the
|
|
|
|
|
* following disclaimer in the documentation and/or other
|
|
|
|
|
* materials provided with the distribution.
|
|
|
|
|
*
|
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
|
|
|
|
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
|
|
|
|
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
|
|
|
|
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
|
|
|
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
|
|
|
|
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
|
|
|
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
|
|
|
|
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
|
|
|
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
|
|
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
|
|
|
|
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
|
|
|
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
|
|
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
|
* SUCH DAMAGE.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using XenAdmin.Core;
|
|
|
|
|
using XenAPI;
|
|
|
|
|
|
|
|
|
|
namespace XenAdmin.Controls
|
|
|
|
|
{
|
|
|
|
|
public class SrPickerMigrateItem : SrPickerItem
|
|
|
|
|
{
|
2020-05-21 16:25:56 +02:00
|
|
|
|
public SrPickerMigrateItem(SR sr, Host aff, VDI[] vdis)
|
|
|
|
|
: base(sr, aff, vdis)
|
2013-06-24 13:41:48 +02:00
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2022-10-11 10:26:54 +02:00
|
|
|
|
protected override bool CanBeEnabled(out string cannotEnableReason)
|
2013-06-24 13:41:48 +02:00
|
|
|
|
{
|
2022-10-11 10:26:54 +02:00
|
|
|
|
if (IsCurrentLocation(out cannotEnableReason))
|
|
|
|
|
return false;
|
2013-06-24 13:41:48 +02:00
|
|
|
|
|
2022-10-11 10:26:54 +02:00
|
|
|
|
if (TheSR.IsLocalSR())
|
2013-06-24 13:41:48 +02:00
|
|
|
|
{
|
2022-10-11 10:26:54 +02:00
|
|
|
|
foreach (var vdi in ExistingVDIs)
|
2019-07-09 16:22:36 +02:00
|
|
|
|
{
|
2022-10-11 10:26:54 +02:00
|
|
|
|
var homeHosts = new List<Host>();
|
|
|
|
|
|
|
|
|
|
var vms = vdi.GetVMs();
|
|
|
|
|
foreach (var vm in vms)
|
2019-07-09 16:22:36 +02:00
|
|
|
|
{
|
2022-10-11 10:26:54 +02:00
|
|
|
|
var homeHost = vm.Home();
|
|
|
|
|
if (homeHost != null)
|
2019-07-09 16:22:36 +02:00
|
|
|
|
{
|
2022-10-11 10:26:54 +02:00
|
|
|
|
homeHosts.Add(homeHost);
|
2019-07-09 16:22:36 +02:00
|
|
|
|
|
2022-10-11 10:26:54 +02:00
|
|
|
|
if (!TheSR.CanBeSeenFrom(homeHost))
|
|
|
|
|
{
|
|
|
|
|
cannotEnableReason = vm.power_state == vm_power_state.Running
|
|
|
|
|
? Messages.SRPICKER_ERROR_LOCAL_SR_MUST_BE_RESIDENT_HOSTS
|
|
|
|
|
: string.Format(Messages.SR_CANNOT_BE_SEEN, Helpers.GetName(homeHost));
|
|
|
|
|
return false;
|
2019-07-09 16:22:36 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
2022-10-11 10:26:54 +02:00
|
|
|
|
}
|
2019-07-09 16:22:36 +02:00
|
|
|
|
|
2022-10-11 10:26:54 +02:00
|
|
|
|
if (homeHosts.Count == 0)
|
|
|
|
|
{
|
|
|
|
|
cannotEnableReason = Messages.SR_IS_LOCAL;
|
|
|
|
|
return false;
|
2019-07-09 16:22:36 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
2013-06-24 13:41:48 +02:00
|
|
|
|
}
|
|
|
|
|
|
2022-10-11 10:26:54 +02:00
|
|
|
|
return SupportsStorageMigration(out cannotEnableReason) &&
|
|
|
|
|
SupportsVdiCreate(out cannotEnableReason) &&
|
|
|
|
|
!IsDetached(out cannotEnableReason) &&
|
|
|
|
|
TheSR.CanFitDisks(out cannotEnableReason, ExistingVDIs);
|
2013-06-24 13:41:48 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2019-07-09 14:51:32 +02:00
|
|
|
|
|
2021-04-27 13:50:16 +02:00
|
|
|
|
public class SrPickerCopyItem : SrPickerItem
|
2013-06-24 13:41:48 +02:00
|
|
|
|
{
|
2021-04-27 13:50:16 +02:00
|
|
|
|
public SrPickerCopyItem(SR sr, Host aff, VDI[] vdis)
|
2020-05-21 16:25:56 +02:00
|
|
|
|
: base(sr, aff, vdis)
|
2013-06-24 13:41:48 +02:00
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2022-10-11 10:26:54 +02:00
|
|
|
|
protected override bool CanBeEnabled(out string cannotEnableReason)
|
|
|
|
|
{
|
|
|
|
|
return !IsDetached(out cannotEnableReason) &&
|
|
|
|
|
SupportsVdiCreate(out cannotEnableReason) &&
|
|
|
|
|
TheSR.CanFitDisks(out cannotEnableReason, ExistingVDIs);
|
2021-04-27 13:50:16 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public class SrPickerMoveItem : SrPickerItem
|
|
|
|
|
{
|
|
|
|
|
public SrPickerMoveItem(SR sr, Host aff, VDI[] vdis)
|
|
|
|
|
: base(sr, aff, vdis)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2022-10-11 10:26:54 +02:00
|
|
|
|
protected override bool CanBeEnabled(out string cannotEnableReason)
|
|
|
|
|
{
|
|
|
|
|
return !IsDetached(out cannotEnableReason) &&
|
|
|
|
|
!IsCurrentLocation(out cannotEnableReason) &&
|
|
|
|
|
SupportsVdiCreate(out cannotEnableReason) &&
|
|
|
|
|
TheSR.CanFitDisks(out cannotEnableReason, ExistingVDIs);
|
2013-06-24 13:41:48 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2019-07-09 14:51:32 +02:00
|
|
|
|
|
2013-06-24 13:41:48 +02:00
|
|
|
|
public class SrPickerInstallFromTemplateItem : SrPickerItem
|
|
|
|
|
{
|
2020-05-21 16:25:56 +02:00
|
|
|
|
public SrPickerInstallFromTemplateItem(SR sr, Host aff, VDI[] vdis)
|
|
|
|
|
: base(sr, aff, vdis)
|
2013-06-24 13:41:48 +02:00
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2022-10-11 10:26:54 +02:00
|
|
|
|
protected override bool CanBeEnabled(out string cannotEnableReason)
|
2016-07-08 12:48:29 +02:00
|
|
|
|
{
|
2022-10-11 10:26:54 +02:00
|
|
|
|
return SupportsVdiCreate(out cannotEnableReason) &&
|
|
|
|
|
!IsDetached(out cannotEnableReason) &&
|
|
|
|
|
TheSR.CanFitDisks(out cannotEnableReason, ExistingVDIs);
|
2013-06-24 13:41:48 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public class SrPickerVmItem : SrPickerItem
|
|
|
|
|
{
|
2020-05-21 16:25:56 +02:00
|
|
|
|
public SrPickerVmItem(SR sr, Host aff, VDI[] vdis)
|
|
|
|
|
: base(sr, aff, vdis)
|
2013-06-24 13:41:48 +02:00
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2022-10-11 10:26:54 +02:00
|
|
|
|
protected override bool CanBeEnabled(out string cannotEnableReason)
|
|
|
|
|
{
|
|
|
|
|
return CanBeSeenFromAffinity(out cannotEnableReason) &&
|
|
|
|
|
SupportsVdiCreate(out cannotEnableReason) &&
|
|
|
|
|
!IsBroken(out cannotEnableReason) &&
|
|
|
|
|
TheSR.CanFitDisks(out cannotEnableReason, ExistingVDIs);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2013-06-24 13:41:48 +02:00
|
|
|
|
|
2022-10-11 10:26:54 +02:00
|
|
|
|
public class SrPickerLunPerVDIItem : SrPickerVmItem
|
|
|
|
|
{
|
|
|
|
|
public SrPickerLunPerVDIItem(SR sr, Host aff, VDI[] vdis)
|
|
|
|
|
: base(sr, aff, vdis)
|
2013-06-24 13:41:48 +02:00
|
|
|
|
{
|
|
|
|
|
}
|
2022-10-11 10:26:54 +02:00
|
|
|
|
|
|
|
|
|
protected override bool CanBeEnabled(out string cannotEnableReason)
|
|
|
|
|
{
|
|
|
|
|
if (TheSR.HBALunPerVDI())
|
|
|
|
|
return CanBeSeenFromAffinity(out cannotEnableReason) &&
|
|
|
|
|
!IsBroken(out cannotEnableReason);
|
|
|
|
|
|
|
|
|
|
return base.CanBeEnabled(out cannotEnableReason);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override bool SupportsCurrentOperation => true;
|
2013-06-24 13:41:48 +02:00
|
|
|
|
}
|
|
|
|
|
|
2019-07-09 14:51:32 +02:00
|
|
|
|
|
2013-06-24 13:41:48 +02:00
|
|
|
|
public abstract class SrPickerItem : CustomTreeNode, IComparable<SrPickerItem>
|
|
|
|
|
{
|
2022-11-15 14:58:22 +01:00
|
|
|
|
private bool _scanning;
|
2019-07-09 16:22:36 +02:00
|
|
|
|
public SR TheSR { get; }
|
2022-10-11 10:26:54 +02:00
|
|
|
|
public bool Show { get; private set; } = true;
|
2019-07-09 16:22:36 +02:00
|
|
|
|
protected readonly Host Affinity;
|
2022-10-11 10:26:54 +02:00
|
|
|
|
protected VDI[] ExistingVDIs { get; private set; }
|
2013-06-24 13:41:48 +02:00
|
|
|
|
|
2022-11-15 14:58:22 +01:00
|
|
|
|
public event Action<SrPickerItem> ItemUpdated;
|
|
|
|
|
|
2020-05-21 16:25:56 +02:00
|
|
|
|
protected SrPickerItem(SR sr, Host aff, VDI[] vdis)
|
2013-06-24 13:41:48 +02:00
|
|
|
|
{
|
2022-10-11 10:26:54 +02:00
|
|
|
|
ExistingVDIs = vdis ?? Array.Empty<VDI>();
|
2013-06-24 13:41:48 +02:00
|
|
|
|
TheSR = sr;
|
|
|
|
|
Affinity = aff;
|
|
|
|
|
Update();
|
|
|
|
|
}
|
|
|
|
|
|
2022-11-15 14:58:22 +01:00
|
|
|
|
public bool Scanning
|
|
|
|
|
{
|
|
|
|
|
get => _scanning;
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
_scanning = value;
|
|
|
|
|
Update();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-10-11 10:26:54 +02:00
|
|
|
|
protected virtual bool SupportsCurrentOperation => !TheSR.HBALunPerVDI();
|
2013-06-24 13:41:48 +02:00
|
|
|
|
|
2022-10-11 10:26:54 +02:00
|
|
|
|
protected abstract bool CanBeEnabled(out string cannotEnableReason);
|
2013-06-24 13:41:48 +02:00
|
|
|
|
|
2022-10-11 10:26:54 +02:00
|
|
|
|
public void UpdateDisks(params VDI[] disks)
|
2013-06-24 13:41:48 +02:00
|
|
|
|
{
|
2022-10-11 10:26:54 +02:00
|
|
|
|
ExistingVDIs = disks;
|
2015-09-18 17:33:25 +02:00
|
|
|
|
Update();
|
|
|
|
|
}
|
|
|
|
|
|
2022-11-15 14:58:22 +01:00
|
|
|
|
public void Update()
|
2013-06-24 13:41:48 +02:00
|
|
|
|
{
|
2017-09-03 04:33:29 +02:00
|
|
|
|
Text = TheSR.Name();
|
2022-10-11 10:26:54 +02:00
|
|
|
|
Image = Images.GetImage16For(TheSR);
|
2013-06-24 13:41:48 +02:00
|
|
|
|
|
2022-10-11 10:26:54 +02:00
|
|
|
|
if (!SupportsCurrentOperation || !SupportsVdiCreate(out _) ||
|
2021-04-27 13:50:16 +02:00
|
|
|
|
!TheSR.Show(Properties.Settings.Default.ShowHiddenVMs))
|
2022-10-11 10:26:54 +02:00
|
|
|
|
{
|
|
|
|
|
Show = false;
|
2019-10-21 17:40:12 +02:00
|
|
|
|
return;
|
2022-10-11 10:26:54 +02:00
|
|
|
|
}
|
2019-10-21 17:40:12 +02:00
|
|
|
|
|
2022-11-15 14:58:22 +01:00
|
|
|
|
if (Scanning)
|
|
|
|
|
{
|
|
|
|
|
Description = Messages.SR_REFRESH_ACTION_TITLE_GENERIC;
|
|
|
|
|
Enabled = false;
|
|
|
|
|
}
|
|
|
|
|
else if (CanBeEnabled(out var cannotEnableReason))
|
2013-06-24 13:41:48 +02:00
|
|
|
|
{
|
2019-10-21 17:40:12 +02:00
|
|
|
|
Description = string.Format(Messages.SRPICKER_DISK_FREE, Util.DiskSizeString(TheSR.FreeSpace(), 2),
|
|
|
|
|
Util.DiskSizeString(TheSR.physical_size, 2));
|
|
|
|
|
Enabled = true;
|
2013-06-24 13:41:48 +02:00
|
|
|
|
}
|
2021-04-27 13:50:16 +02:00
|
|
|
|
else
|
2013-06-24 13:41:48 +02:00
|
|
|
|
{
|
2022-10-11 10:26:54 +02:00
|
|
|
|
Description = cannotEnableReason;
|
2019-10-21 17:40:12 +02:00
|
|
|
|
Enabled = false;
|
2013-06-24 13:41:48 +02:00
|
|
|
|
}
|
2022-11-15 14:58:22 +01:00
|
|
|
|
|
|
|
|
|
ItemUpdated?.Invoke(this);
|
2013-06-24 13:41:48 +02:00
|
|
|
|
}
|
|
|
|
|
|
2022-10-11 10:26:54 +02:00
|
|
|
|
protected bool IsCurrentLocation(out string cannotEnableReason)
|
|
|
|
|
{
|
|
|
|
|
if (ExistingVDIs.Length > 0 && ExistingVDIs.All(vdi => vdi.SR.opaque_ref == TheSR.opaque_ref))
|
|
|
|
|
{
|
|
|
|
|
cannotEnableReason = Messages.CURRENT_LOCATION;
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
cannotEnableReason = string.Empty;
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected bool IsBroken(out string cannotEnableReason)
|
|
|
|
|
{
|
2022-11-30 00:35:32 +01:00
|
|
|
|
if (TheSR.IsBroken())
|
2022-10-11 10:26:54 +02:00
|
|
|
|
{
|
|
|
|
|
cannotEnableReason = Messages.SR_IS_BROKEN;
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
cannotEnableReason = string.Empty;
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected bool IsDetached(out string cannotEnableReason)
|
|
|
|
|
{
|
|
|
|
|
if (TheSR.IsDetached())
|
|
|
|
|
{
|
|
|
|
|
cannotEnableReason = Messages.SR_DETACHED;
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
cannotEnableReason = string.Empty;
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected bool SupportsVdiCreate(out string cannotEnableReason)
|
2013-06-24 13:41:48 +02:00
|
|
|
|
{
|
2022-10-11 10:26:54 +02:00
|
|
|
|
if (TheSR.SupportsVdiCreate())
|
|
|
|
|
{
|
|
|
|
|
cannotEnableReason = string.Empty;
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
cannotEnableReason = Messages.STORAGE_READ_ONLY;
|
|
|
|
|
return false;
|
2013-06-24 13:41:48 +02:00
|
|
|
|
}
|
|
|
|
|
|
2022-10-11 10:26:54 +02:00
|
|
|
|
protected bool SupportsStorageMigration(out string cannotEnableReason)
|
2013-06-24 13:41:48 +02:00
|
|
|
|
{
|
2022-10-11 10:26:54 +02:00
|
|
|
|
if (TheSR.SupportsStorageMigration())
|
2013-06-24 13:41:48 +02:00
|
|
|
|
{
|
2022-10-11 10:26:54 +02:00
|
|
|
|
cannotEnableReason = string.Empty;
|
|
|
|
|
return true;
|
2013-06-24 13:41:48 +02:00
|
|
|
|
}
|
2022-10-11 10:26:54 +02:00
|
|
|
|
|
|
|
|
|
cannotEnableReason = Messages.UNSUPPORTED_SR_TYPE;
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected bool CanBeSeenFromAffinity(out string cannotEnableReason)
|
|
|
|
|
{
|
|
|
|
|
if (Affinity == null)
|
|
|
|
|
{
|
|
|
|
|
if (TheSR.shared)
|
|
|
|
|
{
|
|
|
|
|
cannotEnableReason = string.Empty;
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
cannotEnableReason = Messages.SR_IS_LOCAL;
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
foreach (var pbdRef in TheSR.PBDs)
|
|
|
|
|
{
|
|
|
|
|
var pbd = TheSR.Connection.Resolve(pbdRef);
|
|
|
|
|
|
|
|
|
|
if (pbd.host.opaque_ref == Affinity.opaque_ref)
|
|
|
|
|
{
|
|
|
|
|
if (pbd.currently_attached)
|
|
|
|
|
{
|
|
|
|
|
cannotEnableReason = string.Empty;
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
cannotEnableReason = string.Format(Messages.SR_DETACHED_FROM_HOST, Helpers.GetName(Affinity));
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
cannotEnableReason = string.Format(Messages.SR_CANNOT_BE_SEEN, Helpers.GetName(Affinity));
|
|
|
|
|
return false;
|
2013-06-24 13:41:48 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public int CompareTo(SrPickerItem other)
|
|
|
|
|
{
|
|
|
|
|
return base.CompareTo(other);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override int SameLevelSortOrder(CustomTreeNode other)
|
|
|
|
|
{
|
|
|
|
|
SrPickerItem otherItem = other as SrPickerItem;
|
2019-10-21 17:40:12 +02:00
|
|
|
|
if (otherItem == null) //shouldn't ever happen!!!
|
2013-06-24 13:41:48 +02:00
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
|
|
if (!otherItem.Enabled && Enabled)
|
|
|
|
|
return -1;
|
|
|
|
|
if (otherItem.Enabled && !Enabled)
|
|
|
|
|
return 1;
|
2019-10-21 17:40:12 +02:00
|
|
|
|
|
|
|
|
|
return base.SameLevelSortOrder(otherItem);
|
2013-06-24 13:41:48 +02:00
|
|
|
|
}
|
2019-10-21 17:40:12 +02:00
|
|
|
|
|
2019-07-09 14:51:32 +02:00
|
|
|
|
|
2020-05-21 16:25:56 +02:00
|
|
|
|
public static SrPickerItem Create(SR sr, SrPicker.SRPickerType usage, Host aff, VDI[] vdis)
|
2019-07-09 14:51:32 +02:00
|
|
|
|
{
|
|
|
|
|
switch (usage)
|
|
|
|
|
{
|
|
|
|
|
case SrPicker.SRPickerType.Migrate:
|
2020-05-21 16:25:56 +02:00
|
|
|
|
return new SrPickerMigrateItem(sr, aff, vdis);
|
2021-04-27 13:50:16 +02:00
|
|
|
|
case SrPicker.SRPickerType.Copy:
|
|
|
|
|
return new SrPickerCopyItem(sr, aff, vdis);
|
|
|
|
|
case SrPicker.SRPickerType.Move:
|
|
|
|
|
return new SrPickerMoveItem(sr, aff, vdis);
|
2019-07-09 14:51:32 +02:00
|
|
|
|
case SrPicker.SRPickerType.InstallFromTemplate:
|
2020-05-21 16:25:56 +02:00
|
|
|
|
return new SrPickerInstallFromTemplateItem(sr, aff, vdis);
|
2019-07-09 14:51:32 +02:00
|
|
|
|
case SrPicker.SRPickerType.VM:
|
2020-05-21 16:25:56 +02:00
|
|
|
|
return new SrPickerVmItem(sr, aff, vdis);
|
2019-07-09 14:51:32 +02:00
|
|
|
|
case SrPicker.SRPickerType.LunPerVDI:
|
2020-05-21 16:25:56 +02:00
|
|
|
|
return new SrPickerLunPerVDIItem(sr, aff, vdis);
|
2019-07-09 14:51:32 +02:00
|
|
|
|
default:
|
|
|
|
|
throw new ArgumentException("There is no SRPickerItem for the type: " + usage);
|
|
|
|
|
}
|
|
|
|
|
}
|
2013-06-24 13:41:48 +02:00
|
|
|
|
}
|
|
|
|
|
}
|