Skip to content

Commit ba43130

Browse files
Merge pull request #269 from cedbonzon/development
Fix: persist pool auto_poweron when enabling host autostart
2 parents 79377cf + 3fb8445 commit ba43130

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

‎XenModel/Actions/Host/ChangeHostAutostartAction.cs‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
using System.Text;
3535
using System.Threading.Tasks;
3636
using XenAdmin.Actions;
37+
using XenAdmin.Core;
3738
using XenAdmin.Network;
3839
using XenAPI;
3940

@@ -47,10 +48,19 @@ public ChangeHostAutostartAction(Host host, bool enable) : base(host.Connection,
4748
{
4849
Host = host;
4950
newValue = enable;
51+
52+
ApiMethodsToRoleCheck.AddWithKey("pool.remove_from_other_config", "auto_poweron");
53+
ApiMethodsToRoleCheck.AddWithKey("pool.add_to_other_config", "auto_poweron");
5054
}
5155

5256
protected override void Run()
5357
{
58+
var pool = Helpers.GetPoolOfOne(Connection);
59+
if (pool == null)
60+
return;
61+
Pool.remove_from_other_config(Session, pool.opaque_ref, "auto_poweron");
62+
Pool.add_to_other_config(Session, pool.opaque_ref, "auto_poweron", newValue ? "true" : "false");
63+
5464
Host.SetVmAutostartEnabled(newValue);
5565
}
5666
}

0 commit comments

Comments
 (0)