mirror of
https://github.com/xcp-ng/xenadmin.git
synced 2024-11-25 14:27:26 +01:00
Merge pull request #574 from GaborApatiNagy/master_CA-173497
CA-173497: Thin provisioning: Repair of SR of thin-provisioning on SR hang without return
This commit is contained in:
commit
bfa5db8b40
@ -32,6 +32,7 @@
|
||||
using System;
|
||||
using XenAdmin.Core;
|
||||
using XenAPI;
|
||||
using System.Collections.Generic;
|
||||
|
||||
|
||||
namespace XenAdmin.Actions
|
||||
@ -168,7 +169,37 @@ namespace XenAdmin.Actions
|
||||
if (SR.PBDs.Count < 1)
|
||||
return;
|
||||
|
||||
foreach (XenRef<PBD> pbd in SR.PBDs)
|
||||
//CA-176935, CA-173497 - we need to run Unplug for the master last - creating a new list of hosts where the master is always the last
|
||||
var allPBDRefsToNonMaster = new List<XenRef<PBD>>();
|
||||
var allPBDRefsToMaster = new List<XenRef<PBD>>();
|
||||
|
||||
var master = Helpers.GetMaster(Connection);
|
||||
|
||||
foreach (var pbdRef in SR.PBDs)
|
||||
{
|
||||
var pbd = Connection.Resolve(pbdRef);
|
||||
if (pbd != null)
|
||||
{
|
||||
if (pbd.host != null)
|
||||
{
|
||||
var host = Connection.Resolve(pbd.host);
|
||||
if (master != null && host != null && host.uuid == master.uuid)
|
||||
{
|
||||
allPBDRefsToMaster.Add(pbdRef);
|
||||
}
|
||||
else
|
||||
{
|
||||
allPBDRefsToNonMaster.Add(pbdRef);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var allPBDRefs = new List<XenRef<PBD>>();
|
||||
allPBDRefs.AddRange(allPBDRefsToNonMaster);
|
||||
allPBDRefs.AddRange(allPBDRefsToMaster);
|
||||
|
||||
foreach (XenRef<PBD> pbd in allPBDRefs)
|
||||
{
|
||||
RelatedTask = PBD.async_unplug(Session, pbd.opaque_ref);
|
||||
PollToCompletion(PercentComplete, PercentComplete + inc);
|
||||
|
@ -74,7 +74,18 @@ namespace XenAdmin.Actions
|
||||
log.Debug("Running SR repair");
|
||||
log.DebugFormat("SR='{0}'", SR.Name);
|
||||
|
||||
foreach (Host host in Connection.Cache.Hosts)
|
||||
//CA-176935, CA-173497 - we need to run Plug for the master first - creating a new list of hosts where the master is always first
|
||||
var allHosts = new List<Host>();
|
||||
|
||||
var master = Helpers.GetMaster(Connection);
|
||||
if (master != null)
|
||||
allHosts.Add(master);
|
||||
|
||||
foreach (var host in Connection.Cache.Hosts)
|
||||
if (!allHosts.Contains(host))
|
||||
allHosts.Add(host);
|
||||
|
||||
foreach (Host host in allHosts)
|
||||
{
|
||||
Host stoHost = SR.GetStorageHost();
|
||||
if (SR.shared
|
||||
|
Loading…
Reference in New Issue
Block a user