|
| 1 | +--- |
| 2 | +title: Schedule Snapshot Design |
| 3 | +layout: default |
| 4 | +design_doc: true |
| 5 | +revision: 1 |
| 6 | +status: proposed |
| 7 | +--- |
| 8 | + |
| 9 | +The scheduled snapshot feature will utilize the existing architecture of VMPR. In terms of functionality, schedule snapshot is basically VMPR without its archiving capability. |
| 10 | + |
| 11 | +Introduction |
| 12 | +------------ |
| 13 | + |
| 14 | +* Schedule snapshot will be a new object in xapi as VMSS. |
| 15 | +* A pool can have multiple VMSS and each VMSS will be configured to take snapshot of type disk, checkpoint or quiesce for the VMs as part of VMSS, on configured intervals. |
| 16 | + |
| 17 | +Datapath Design |
| 18 | +--------------- |
| 19 | + |
| 20 | +* There will be a cron job for VMSS. |
| 21 | +* VMSS plugin will go through all the schedule snapshot policies in the pool and check if any of them are due. |
| 22 | +* If a snapshot is due then : Go through all the VM objects in XAPI associated with this schedule snapshot policy and create a new snapshot. |
| 23 | +* If the snapshot operation fails, create a notification alert for the event and move to the next VM. |
| 24 | +* Flag the snapshot to have been created by the schedule service, using either other-config for the VM object or another parameter added for this purpose. |
| 25 | +* Check if an older snapshot now needs to be deleted to comply with the retention value defined in the schedule policy. |
| 26 | +* If we need to delete any existing snapshots, delete the oldest snapshot created via schedule policy. |
| 27 | +* Set the last-run timestamp in the schedule policy. |
| 28 | + |
| 29 | +Xapi Changes |
| 30 | +------------ |
| 31 | + |
| 32 | +There is a new record for VM Scheduled Snapshot with new fields. |
| 33 | + |
| 34 | +New fields: |
| 35 | + |
| 36 | +* "name-label" type String : Name label for VMSS. |
| 37 | +* "name-description" type String : Name description for VMSS. |
| 38 | +* "is-schedule-snapshot-enabled" type Bool : Enable/Disable VMSS to take snapshot. |
| 39 | +* "schedule-snapshot-type" type [DiskSnapshot; Checkpoint; Quiesce] : Type of snapshot policy takes. |
| 40 | +* "schedule-snapshot-retention-value" type Int64 : Number of snapshots limit for a VM, max limit is 10. |
| 41 | +* "schedule-snapshot-frequency" type [hourly; daily; weekly] : Frequency of taking snapshot of VMs. |
| 42 | +* "snapshot-schedule" type (hour: DateTime, min: DateTime, days: string list) : Time Hour, Min of interval of 15mins and Days of a week. |
| 43 | +* "is-schedule-snapshot-running" type Bool : If VMSS is in progress of taking snapshot. |
| 44 | +* "schedule-snapshot-last-run-time" type Date : DateTime of last execution of VMSS. |
| 45 | +* "is-alarm-enabled" type Bool : Alarm enable/disable for VMSS. |
| 46 | +* "alarm-config" : type (is_alarm_enabled,["email_address", ((String), "");"smtp_server", ((String), "");"smtp_port", ((IntRange(1,65535)), "25")] : Sets the alarm config field for VMSS. |
| 47 | +* "VMs" type VM refs : List of VMs part of VMSS. |
| 48 | + |
| 49 | +New fields to VM record: |
| 50 | + |
| 51 | +* "schedule-snapshot" type VMSS ref : VM part of VMSS. |
| 52 | +* "is-snapshot-from-vmss" type Bool : If snapshot created from VMSS. |
| 53 | + |
| 54 | +New APIs |
| 55 | +-------- |
| 56 | + |
| 57 | +* vmss_snapshot_now (Ref vmss, Pool_Operater) -> String : This call executes the schedule snapshot immediately. |
| 58 | +* vmss_create_alert (Ref _vmss, String "name", Int "priority", String "body", String "data", Local_Root) -> unit : This call creates an alert for schedule snapshot. |
| 59 | +* vmss_get_alerts (Ref vmss, Int "hours_from_now", Pool_Operater) -> Set String : This call fetches a history of alerts for a given schedule snapshot |
| 60 | +* vmss_set_snapshot_retention_value (Ref vmss, Int value, Pool_Operater) -> unit : Set the value of the_schedule_snapshot_retention value max is 10. |
| 61 | +* vmss_set_is_schedule_snapshot_running (Ref vmss, Bool value, Local_Root) -> unit : Set the value of the is_schedule_snapshot_running field |
| 62 | +* vmss_set_snapshot_frequency (Ref vmss, String "value", Pool_Operater) -> unit : Set the value of the snapshot_frequency field |
| 63 | +* vmss_set_snapshot_schedule (Ref vmss, Map(String,String) "value", Pool_Operater) -> unit : Set the schedule to take snapshot. |
| 64 | +* vmss_set_is_alarm_enabled (Ref vmss, Bool "value", Pool_Operater) -> unit : Set the value of the is_alarm_enabled field |
| 65 | +* vmss_set_alarm_config (Ref vmss, Map(String,String) "value", Pool_Operater) -> unit : Set the alarm_config |
| 66 | +* vmss_add_to_snapshot_schedule (Ref vmss, String "key", String "value", Pool_Operater) -> unit : Add key value pair to VMSS |
| 67 | +* vmss_add_to_alarm_config (Ref vmss, String "key", String "value", Pool_Operater) -> unit : Add key value pair to alarm_config field. |
| 68 | +* vmss_remove_from_snapshot_schedule (Ref vmss, String "key", Pool_Operater) -> unit : Remove key from VMSS. |
| 69 | +* vmss_remove_from_alarm_config (Ref vmss, String "key", Pool_Operater) -> unit : Remove key from alarm_config field. |
| 70 | +* vmss_set_schedule_snapshot_last_run_time (Ref vmss, DateTime "value", Local_Root) -> unit : Set the last run time for VMSS. |
| 71 | + |
| 72 | +New CLIs |
| 73 | +-------- |
| 74 | + |
| 75 | +* vmss-create (required : "name-label";"schedule-snapshot-type";"schedule-snapshot-frequency", optional : "name-description";"is-schedule-snapshot-enabled";"snapshot-schedule:";"snapshot-retention-value";"is-alarm-enabled";"alarm-config:") -> unit : Creates VM schedule snapshot. |
| 76 | +* vmss-destroy (required : uuid) -> unit : Destroys a VM schedule snapshot. |
| 77 | + |
0 commit comments