示例#1
0
 public async Task <OneFuzzResultVoid> AcquireScaleInProtection(Node node)
 {
     if (await ScalesetNodeExists(node) && node.ScalesetId != null)
     {
         _logTracer.Info($"Setting scale-in protection on node {node.MachineId}");
         return(await _context.VmssOperations.UpdateScaleInProtection((Guid)node.ScalesetId, node.MachineId, protectFromScaleIn : true));
     }
     return(OneFuzzResultVoid.Ok());
 }
示例#2
0
    public async Async.Task <OneFuzzResultVoid> UpdateExtensions(Guid name, IList <VirtualMachineScaleSetExtensionData> extensions)
    {
        var canUpdate = await CheckCanUpdate(name);

        if (canUpdate.IsOk)
        {
            _log.Info($"updating VM extensions: {name}");
            var res   = GetVmssResource(name);
            var patch = new VirtualMachineScaleSetPatch();

            foreach (var ext in extensions)
            {
                patch.VirtualMachineProfile.ExtensionProfile.Extensions.Add(ext);
            }
            var _ = await res.UpdateAsync(WaitUntil.Started, patch);

            _log.Info($"VM extensions updated: {name}");
            return(OneFuzzResultVoid.Ok());
        }
        else
        {
            return(OneFuzzResultVoid.Error(canUpdate.ErrorV));
        }
    }