Skip to content

Commit 6950c4a

Browse files
authored
Scheduled updates review feedback
1 parent 9dbc13b commit 6950c4a

File tree

1 file changed

+15
-11
lines changed

1 file changed

+15
-11
lines changed

articles/virtual-machines/windows/scheduled-events.md

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,10 @@ With Scheduled Events, your application can discover when maintenance will occur
4040

4141
Scheduled Events provides events in the following use cases:
4242

43-
- [Platform initiated maintenance](../maintenance-and-updates.md?bc=/azure/virtual-machines/windows/breadcrumb/toc.json&toc=/azure/virtual-machines/windows/toc.json) (for example, VM reboot, live migration or memory preserving updates for host)
44-
- Virtual machine is running on [degraded host hardware](https://azure.microsoft.com/blog/find-out-when-your-virtual-machine-hardware-is-degraded-with-scheduled-events) that is predicted to fail soon
45-
- Virtual machine was running on a host that suffered a hardware failure
46-
- User-initiated maintenance (for example, a user restarts or redeploys a VM)
43+
- [Platform initiated maintenance](../maintenance-and-updates.md?bc=/azure/virtual-machines/windows/breadcrumb/toc.json&toc=/azure/virtual-machines/windows/toc.json) (for example, VM reboot, live migration or memory preserving updates for host).
44+
- Virtual machine is running on [degraded host hardware](https://azure.microsoft.com/blog/find-out-when-your-virtual-machine-hardware-is-degraded-with-scheduled-events) that is predicted to fail soon.
45+
- Virtual machine was running on a host that suffered a hardware failure.
46+
- User-initiated maintenance (for example, a user restarts or redeploys a VM).
4747
- [Spot VM](../spot-vms.md) and [Spot scale set](../../virtual-machine-scale-sets/use-spot.md) instance evictions.
4848

4949
## The Basics
@@ -156,13 +156,13 @@ In the case where there are scheduled events, the response contains an array of
156156
### Event properties
157157
|Property | Description |
158158
| - | - |
159-
| Document Incarnation | Integer that increases when the events contained in the array of scheduled events changes. Documents with the same incarnation contain the same event information, and the incarnation will be incremented when an event changes. |
159+
| Document Incarnation | Integer that increases when the events array changes. Documents with the same incarnation contain the same event information, and the incarnation will be incremented when an event changes. |
160160
| EventId | Globally unique identifier for this event. <br><br> Example: <br><ul><li>602d9444-d2cd-49c7-8624-8643e7171297 |
161161
| EventType | Impact this event causes. <br><br> Values: <br><ul><li> `Freeze`: The Virtual Machine is scheduled to pause for a few seconds. CPU and network connectivity may be suspended, but there is no impact on memory or open files.<li>`Reboot`: The Virtual Machine is scheduled for reboot (non-persistent memory is lost). <li>`Redeploy`: The Virtual Machine is scheduled to move to another node (ephemeral disks are lost). <li>`Preempt`: The Spot Virtual Machine is being deleted (ephemeral disks are lost). This event is made available on a best effort basis <li> `Terminate`: The virtual machine is scheduled to be deleted. |
162162
| ResourceType | Type of resource this event affects. <br><br> Values: <ul><li>`VirtualMachine`|
163163
| Resources| List of resources this event affects. The list is guaranteed to contain machines from at most one [update domain](../availability.md), but it might not contain all machines in the UD. <br><br> Example: <br><ul><li> ["FrontEnd_IN_0", "BackEnd_IN_0"] |
164164
| EventStatus | Status of this event. <br><br> Values: <ul><li>`Scheduled`: This event is scheduled to start after the time specified in the `NotBefore` property.<li>`Started`: This event has started.</ul> No `Completed` or similar status is ever provided. The event is no longer returned when the event is finished.
165-
| NotBefore| Time after which this event can start. The event is guaranteed to not start before this time. <br><br> Example: <br><ul><li> Mon, 19 Sep 2016 18:29:47 GMT |
165+
| NotBefore| Time after which this event can start. The event is guaranteed to not start before this time. Will be blank if the event has already started <br><br> Example: <br><ul><li> Mon, 19 Sep 2016 18:29:47 GMT |
166166
| Description | Description of this event. <br><br> Example: <br><ul><li> Host server is undergoing maintenance. |
167167
| EventSource | Initiator of the event. <br><br> Example: <br><ul><li> `Platform`: This event is initiated by platform. <li>`User`: This event is initiated by user. |
168168
| DurationInSeconds | The expected duration of the interruption caused by the event. <br><br> Example: <br><ul><li> `9`: The interruption caused by the event will last for 9 seconds. <li>`-1`: The default value used if the impact duration is either unknown or not applicable. |
@@ -182,7 +182,7 @@ Each event is scheduled a minimum amount of time in the future based on the even
182182
> In some cases, Azure is able to predict host failure due to degraded hardware and will attempt to mitigate disruption to your service by scheduling a migration. Affected virtual machines will receive a scheduled event with a `NotBefore` that is typically a few days in the future. The actual time varies depending on the predicted failure risk assessment. Azure tries to give 7 days' advance notice when possible, but the actual time varies and might be smaller if the prediction is that there is a high chance of the hardware failing imminently. To minimize risk to your service in case the hardware fails before the system-initiated migration, we recommend that you self-redeploy your virtual machine as soon as possible.
183183
184184
>[!NOTE]
185-
> In the case the host node experiences a hardware failure Azure will bypass the minimum notice period an immediately begin the recovery process for affected virtual machines. This reduces recovery time in the case that the affected VMs are unable to respond. During the recovery process an event will be created for all impacted VMs with EventType = Reboot and EventStatus = Started
185+
> In the case the host node experiences a hardware failure Azure will bypass the minimum notice period an immediately begin the recovery process for affected virtual machines. This reduces recovery time in the case that the affected VMs are unable to respond. During the recovery process an event will be created for all impacted VMs with `EventType = Reboot` and `EventStatus = Started`.
186186
187187
### Polling frequency
188188

@@ -193,6 +193,7 @@ You can poll the endpoint for updates as frequently or infrequently as you like.
193193
After you learn of an upcoming event and finish your logic for graceful shutdown, you can approve the outstanding event by making a `POST` call to Metadata Service with `EventId`. This call indicates to Azure that it can shorten the minimum notification time (when possible). The event may not start immediately upon approval, in some cases Azure will require the approval of all the VMs hosted on the node before proceeding with the event.
194194

195195
The following JSON sample is expected in the `POST` request body. The request should contain a list of `StartRequests`. Each `StartRequest` contains `EventId` for the event you want to expedite:
196+
196197
```
197198
{
198199
"StartRequests" : [
@@ -222,9 +223,11 @@ import requests
222223
def confirm_scheduled_event(event_id):
223224
# This payload confirms a single event with id event_id
224225
payload = json.dumps({"StartRequests": [{"EventId": event_id }]})
225-
response = requests.post(metadata_url, headers= header, params = query_params, data = payload)
226+
response = requests.post("http://169.254.169.254/metadata/scheduledevents",
227+
headers = {'Metadata' : 'true'},
228+
params = {'api-version':'2020-07-01'},
229+
data = payload)
226230
return response.status_code
227-
228231
````
229232

230233
> [!NOTE]
@@ -337,9 +340,10 @@ def advanced_sample(last_document_incarnation):
337340
payload = get_scheduled_events()
338341
found_document_incarnation = payload["DocumentIncarnation"]
339342

340-
# We recommend processing all events in a document incarnation together,
343+
# We recommend processing all events in a document together,
341344
# even if you won't be actioning on them right away
342345
for event in payload["Events"]:
346+
343347
# Events that have already started, logged for tracking
344348
if (event["EventStatus"] == "Started"):
345349
log(event)
@@ -387,7 +391,7 @@ if __name__ == '__main__':
387391

388392
## Next steps
389393
- Review the Scheduled Events code samples in the [Azure Instance Metadata Scheduled Events GitHub repository](https://github.com/Azure-Samples/virtual-machines-scheduled-events-discover-endpoint-for-non-vnet-vm).
390-
- Review the nodejs Scheduled Events code samples in [Azure Samples GitHub repository](https://github.com/Azure/vm-scheduled-events).
394+
- Review the Node.js Scheduled Events code samples in [Azure Samples GitHub repository](https://github.com/Azure/vm-scheduled-events).
391395
- Read more about the APIs that are available in the [Instance Metadata Service](instance-metadata-service.md).
392396
- Learn about [planned maintenance for Windows virtual machines in Azure](../maintenance-and-updates.md?bc=/azure/virtual-machines/windows/breadcrumb/toc.json&toc=/azure/virtual-machines/windows/toc.json).
393397
- Learn how to [monitor scheduled events for your VMs through Log Analytics](./scheduled-event-service.md).

0 commit comments

Comments
 (0)