CA-287856: Add new API calls and update SR repair (#2043)

* CA-287856: Add new API calls and update SR repair

* CA-287856: changed setIscsiIQN and added try/catch

* CA-287856: correct method

* CA-287856: add else
This commit is contained in:
serencorbett1 2018-04-20 13:26:42 +01:00 committed by Mihaela Stoica
parent 8a16c794c1
commit e90b04d783
3 changed files with 46 additions and 8 deletions

View File

@ -31,6 +31,7 @@
using System;
using System.Collections.Generic;
using XenAdmin.Core;
using XenAPI;
@ -71,18 +72,22 @@ namespace XenAdmin.Actions
}
// CA-19392: Multipath enablement / disablement
if (multipath)
if (Helpers.KolkataOrGreater(host))
{
Host.remove_from_other_config(Session, host.opaque_ref, Host.MULTIPATH);
Host.add_to_other_config(Session, host.opaque_ref, Host.MULTIPATH, "true");
Host.remove_from_other_config(Session, host.opaque_ref, Host.MULTIPATH_HANDLE);
Host.add_to_other_config(Session, host.opaque_ref, Host.MULTIPATH_HANDLE, DEFAULT_MULTIPATH_HANDLE);
Host.set_multipathing(Session, host.opaque_ref, multipath);
}
else
{
Host.remove_from_other_config(Session, host.opaque_ref, Host.MULTIPATH);
Host.add_to_other_config(Session, host.opaque_ref, Host.MULTIPATH, "false");
Host.remove_from_other_config(Session, host.opaque_ref, Host.MULTIPATH_HANDLE);
Host.add_to_other_config(Session, host.opaque_ref, Host.MULTIPATH, multipath.ToString().ToLowerInvariant());
}
Host.remove_from_other_config(Session, host.opaque_ref, Host.MULTIPATH_HANDLE);
if (multipath)
{
Host.add_to_other_config(Session, host.opaque_ref, Host.MULTIPATH_HANDLE, DEFAULT_MULTIPATH_HANDLE);
}
}

View File

@ -32,6 +32,7 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using XenAdmin.Network;
using XenAdmin.Core;
using XenAPI;
@ -108,6 +109,23 @@ namespace XenAdmin.Actions
int max = _hostList.Count * 2;
int delta = 100 / max;
try
{
if (SR.GetSRType(true) == SR.SRTypes.gfs2)
{
var cluster = Connection.Cache.Clusters.FirstOrDefault();
if (cluster != null)
{
Cluster.pool_resync(Session, cluster.opaque_ref);
}
}
}
catch (Exception e)
{
log.DebugFormat("Cluster pool resync failed with {0}", e.Message);
}
foreach (Host host in _hostList)
{
if (!host.HasPBDTo(SR) && SR.shared && SR.PBDs.Count > 0)

View File

@ -150,12 +150,23 @@ namespace XenAPI
public string GetIscsiIqn()
{
if (Helpers.KolkataOrGreater(this))
{
return iscsi_iqn;
}
return Get(other_config, "iscsi_iqn") ?? "";
}
public void SetIscsiIqn(string value)
{
other_config = SetDictionaryKey(other_config, "iscsi_iqn", value);
if (Helpers.KolkataOrGreater(this))
{
iscsi_iqn = value;
}
else
{
other_config = SetDictionaryKey(other_config, "iscsi_iqn", value);
}
}
public override string ToString()
@ -493,6 +504,10 @@ namespace XenAPI
public bool MultipathEnabled()
{
if (Helpers.KolkataOrGreater(this))
{
return multipathing;
}
return BoolKey(other_config, MULTIPATH);
}