44
Cloud Open, October 2013 1 RAM Snapshots 21.10.2013 Arik Hadas Red Hat

RAM Snapshots · 2017. 12. 14. · RAM Snapshots Disks snapshot with memory state When running VM that was reverted to RAM snapshot The saved state (memory + disks) is restored TCP

  • Upload
    others

  • View
    3

  • Download
    0

Embed Size (px)

Citation preview

Page 1: RAM Snapshots · 2017. 12. 14. · RAM Snapshots Disks snapshot with memory state When running VM that was reverted to RAM snapshot The saved state (memory + disks) is restored TCP

Cloud Open, October 2013 1

RAM Snapshots

21.10.2013

Arik HadasRed Hat

Page 2: RAM Snapshots · 2017. 12. 14. · RAM Snapshots Disks snapshot with memory state When running VM that was reverted to RAM snapshot The saved state (memory + disks) is restored TCP

Cloud Open, October 2013 2

● Quick overview of oVirt architecture & volume types

● Overview of snapshots in oVirt

● Deep dive into RAM snapshot feature● The concept● Implementation details● How to use

Agenda

Page 3: RAM Snapshots · 2017. 12. 14. · RAM Snapshots Disks snapshot with memory state When running VM that was reverted to RAM snapshot The saved state (memory + disks) is restored TCP

Cloud Open, October 2013 3

oVirt architecture

Page 4: RAM Snapshots · 2017. 12. 14. · RAM Snapshots Disks snapshot with memory state When running VM that was reverted to RAM snapshot The saved state (memory + disks) is restored TCP

Cloud Open, October 2013 4

Virtual disk structure

● Virtual disk image is composed of volumes

● Volume Types● Raw - plain binary data● COW – only data that was changed

● QCOW2 (QEMU Copy On Write 2)

Volume 1 (Raw/COW)Volume 1 (Raw/COW) Volume 2 (COW)Volume 2 (COW) Volume 3 (COW)Volume 3 (COW)

Image 1

Page 5: RAM Snapshots · 2017. 12. 14. · RAM Snapshots Disks snapshot with memory state When running VM that was reverted to RAM snapshot The saved state (memory + disks) is restored TCP

Cloud Open, October 2013 5

Write data to disk with COW volume

● The data will be stored in the last COW volume

● COW volumes contain the data that was changed after they were created

● All the volumes except the last one become read-only

Volume 1 (Raw/COW)Volume 1 (Raw/COW) Volume 2 (COW)Volume 2 (COW) Volume 3 (COW)Volume 3 (COW)

Image 1

Page 6: RAM Snapshots · 2017. 12. 14. · RAM Snapshots Disks snapshot with memory state When running VM that was reverted to RAM snapshot The saved state (memory + disks) is restored TCP

Cloud Open, October 2013 6

Read data from disk with COW volume

● We will try to read the data from the last volume● The volume contains meta-data that indicates which

data exist in the volume● If the data exist in the volume

● We’ll read it from the volume

● Otherwise● We’ll try to read it from the ‘parent’ volume

Volume 1 (Raw/COW)Volume 1 (Raw/COW) Volume 2 (COW)Volume 2 (COW) Volume 3 (COW)Volume 3 (COW)

Image 1

Page 7: RAM Snapshots · 2017. 12. 14. · RAM Snapshots Disks snapshot with memory state When running VM that was reverted to RAM snapshot The saved state (memory + disks) is restored TCP

Cloud Open, October 2013 7

Snapshot usages in oVirt (1)

● Backup & Restore

● Create snapshot● Preview snapshot● Commit to snapshot

Snapshot Name Volumes

Active VM Volume 1

Volume 1Volume 1

Image 1

Page 8: RAM Snapshots · 2017. 12. 14. · RAM Snapshots Disks snapshot with memory state When running VM that was reverted to RAM snapshot The saved state (memory + disks) is restored TCP

Cloud Open, October 2013 8

Snapshot usages in oVirt (1)

● Backup & Restore

● Create snapshot● Preview snapshot● Commit to snapshot

Snapshot Name Volumes

Active VM Volume 2

Snapshot 1 Volume 1

Volume 1Volume 1 Volume 2Volume 2

Image 1

Snapshot Name Volumes

Active VM Volume 1

Volume 1Volume 1

Image 1

Page 9: RAM Snapshots · 2017. 12. 14. · RAM Snapshots Disks snapshot with memory state When running VM that was reverted to RAM snapshot The saved state (memory + disks) is restored TCP

Cloud Open, October 2013 9

Snapshot usages in oVirt (1)

● Backup & Restore

● Create snapshot● Preview snapshot● Commit to snapshot

Snapshot Name Volumes

Active VM Volume 3

Previous Active VM Volume 2

Snapshot 1 Volume 1

Volume 1Volume 1Volume 3Volume 3

Image 1Volume 2Volume 2

Snapshot Name Volumes

Active VM Volume 2

Snapshot 1 Volume 1

Volume 1Volume 1 Volume 2Volume 2

Image 1

Page 10: RAM Snapshots · 2017. 12. 14. · RAM Snapshots Disks snapshot with memory state When running VM that was reverted to RAM snapshot The saved state (memory + disks) is restored TCP

Cloud Open, October 2013 10

Snapshot usages in oVirt (1)

● Backup & Restore

● Create snapshot● Preview snapshot● Commit to snapshot

Snapshot Name Volumes

Active VM Volume 3

Snapshot 1 Volume 1

Volume 1Volume 1 Volume 3Volume 3

Image 1

Snapshot Name Volumes

Active VM Volume 3

Previous Active VM Volume 2

Snapshot 1 Volume 1

Volume 1Volume 1Volume 3Volume 3

Image 1Volume 2Volume 2

Page 11: RAM Snapshots · 2017. 12. 14. · RAM Snapshots Disks snapshot with memory state When running VM that was reverted to RAM snapshot The saved state (memory + disks) is restored TCP

Cloud Open, October 2013 11

Snapshot usages in oVirt (2)

Stateless VM implementation

Volume 1Volume 1

Image 1

Snapshot Name Volumes

Active VM Volume1

Page 12: RAM Snapshots · 2017. 12. 14. · RAM Snapshots Disks snapshot with memory state When running VM that was reverted to RAM snapshot The saved state (memory + disks) is restored TCP

Cloud Open, October 2013 12

Snapshot usages in oVirt (2)

Stateless VM implementation

Volume 1Volume 1

Image 1

Snapshot Name Volumes

Active VM Volume1

Volume 1Volume 1 Temporary VolumeTemporary Volume

Image 1

Snapshot Name Volumes

Active VM Temporary volume

Stateless snapshot Volume 1

Page 13: RAM Snapshots · 2017. 12. 14. · RAM Snapshots Disks snapshot with memory state When running VM that was reverted to RAM snapshot The saved state (memory + disks) is restored TCP

Cloud Open, October 2013 13

Snapshot usages in oVirt (3)

Preliminary step in Live Storage Migration process

Page 14: RAM Snapshots · 2017. 12. 14. · RAM Snapshots Disks snapshot with memory state When running VM that was reverted to RAM snapshot The saved state (memory + disks) is restored TCP

Cloud Open, October 2013 14

Snapshot usages in oVirt (3)

Preliminary step in Live Storage Migration process

Page 15: RAM Snapshots · 2017. 12. 14. · RAM Snapshots Disks snapshot with memory state When running VM that was reverted to RAM snapshot The saved state (memory + disks) is restored TCP

Cloud Open, October 2013 15

Snapshot usages in oVirt (3)

Preliminary step in Live Storage Migration process

Page 16: RAM Snapshots · 2017. 12. 14. · RAM Snapshots Disks snapshot with memory state When running VM that was reverted to RAM snapshot The saved state (memory + disks) is restored TCP

Cloud Open, October 2013 16

Snapshot Types in oVirt

Offline Snapshot● Taking snapshot for VM which is not running● Add volume for each of the VM disks● The added volumes will be used on next run

Engine VDSM

create volume

create volume

create volume

Page 17: RAM Snapshots · 2017. 12. 14. · RAM Snapshots Disks snapshot with memory state When running VM that was reverted to RAM snapshot The saved state (memory + disks) is restored TCP

Cloud Open, October 2013 17

Snapshot Types in oVirt

Live Snapshot● Taking snapshot for running VM● Add volume for each of the VM disks● The VM switch to the added volumes

Engine VDSM Libvirt

create volume

create volume

snapshot

virDomainSnapshotCreateXML

Page 18: RAM Snapshots · 2017. 12. 14. · RAM Snapshots Disks snapshot with memory state When running VM that was reverted to RAM snapshot The saved state (memory + disks) is restored TCP

Cloud Open, October 2013 18

Libvirt API

● VM: VM ID

● xml: snapshot properties in xml format

● flags: snapshot properties as flags

virDomainSnapshotCreateXML (VM, xml, flags)

Page 19: RAM Snapshots · 2017. 12. 14. · RAM Snapshots Disks snapshot with memory state When running VM that was reverted to RAM snapshot The saved state (memory + disks) is restored TCP

Cloud Open, October 2013 19

Snapshot types in libvirt

● Disks snapshot● Internal● External

● Memory state (VM state)● Piggy-backed● External

● System checkpoint● Disk snapshot + Memory state

Page 20: RAM Snapshots · 2017. 12. 14. · RAM Snapshots Disks snapshot with memory state When running VM that was reverted to RAM snapshot The saved state (memory + disks) is restored TCP

Cloud Open, October 2013 20

Snapshot types in libvirt

● Disks snapshot● Internal● External

● Memory state (VM state)● Piggy-backed● External

● System checkpoint● Disk snapshot + Memory state

Cow volume

Snapshot data

Snapshot data

Disk data

meta data

Page 21: RAM Snapshots · 2017. 12. 14. · RAM Snapshots Disks snapshot with memory state When running VM that was reverted to RAM snapshot The saved state (memory + disks) is restored TCP

Cloud Open, October 2013 21

Snapshot types in libvirt

● Disks snapshot● Internal● External

● Memory state (VM state)● Piggy-backed● External

● System checkpoint● Disk snapshot + Memory state

Page 22: RAM Snapshots · 2017. 12. 14. · RAM Snapshots Disks snapshot with memory state When running VM that was reverted to RAM snapshot The saved state (memory + disks) is restored TCP

Cloud Open, October 2013 22

Live snapshot in libvirt

● External disks snapshot

● xml● Volume to switch to for each disk

● flags● VIR_DOMAIN_SNAPSHOT_CREATE_DISK_ONLY

● VIR_DOMAIN_SNAPSHOT_CREATE_REUSE_EXT

● VIR_DOMAIN_SNAPSHOT_CREATE_NO_METADATA

● VIR_DOMAIN_SNAPSHOT_CREATE_QUIESCE

Page 23: RAM Snapshots · 2017. 12. 14. · RAM Snapshots Disks snapshot with memory state When running VM that was reverted to RAM snapshot The saved state (memory + disks) is restored TCP

Cloud Open, October 2013 23

RAM Snapshots

● Disks snapshot with memory state

● When running VM that was reverted to RAM snapshot ● The saved state (memory + disks) is restored● TCP connections might time out

● Unlike hibernation the VM remains active

Page 24: RAM Snapshots · 2017. 12. 14. · RAM Snapshots Disks snapshot with memory state When running VM that was reverted to RAM snapshot The saved state (memory + disks) is restored TCP

Cloud Open, October 2013 24

Creating RAM Snapshots

Engine VDSM Libvirt

create volume

create volume

snapshot

virDomainSnapshotCreateXML

create volume

create volume

save VM properties

Page 25: RAM Snapshots · 2017. 12. 14. · RAM Snapshots Disks snapshot with memory state When running VM that was reverted to RAM snapshot The saved state (memory + disks) is restored TCP

Cloud Open, October 2013 25

RAM snapshots in libvirt

● System checkpoint● External disks snapshot● External memory state

● xml● Volume to switch to for each disk● Volume to save the memory state in

● flags● VIR_DOMAIN_SNAPSHOT_CREATE_LIVE

● VIR_DOMAIN_SNAPSHOT_CREATE_REUSE_EXT

● VIR_DOMAIN_SNAPSHOT_CREATE_NO_METADATA

Page 26: RAM Snapshots · 2017. 12. 14. · RAM Snapshots Disks snapshot with memory state When running VM that was reverted to RAM snapshot The saved state (memory + disks) is restored TCP

Cloud Open, October 2013 26

RAM snapshot usages

● Create snapshot with memory

● Preview snapshot with memory

● Commit to snapshot with memory

● Stateless VM with initial memory

Snapshot Name Volumes Memory

Active VM Volume 1

Volume 1Volume 1

Image 1

Page 27: RAM Snapshots · 2017. 12. 14. · RAM Snapshots Disks snapshot with memory state When running VM that was reverted to RAM snapshot The saved state (memory + disks) is restored TCP

Cloud Open, October 2013 27

RAM snapshot usages

● Create snapshot with memory

● Preview snapshot with memory

● Commit to snapshot with memory

● Stateless VM with initial memory

Snapshot Name Volumes Memory

Active VM Volume 2

Snapshot 1 Volume 1 Memory 1

Volume 1Volume 1 Volume 2Volume 2

Image 1

Snapshot Name Volumes Memory

Active VM Volume 1

Volume 1Volume 1

Image 1

VM properties volumeVM properties volumeImage

Memory state volumeMemory state volumeImage

Memory 1

Page 28: RAM Snapshots · 2017. 12. 14. · RAM Snapshots Disks snapshot with memory state When running VM that was reverted to RAM snapshot The saved state (memory + disks) is restored TCP

Cloud Open, October 2013 28

RAM snapshot usages

● Create snapshot with memory

● Preview snapshot with memory

● Commit to snapshot with memory

● Stateless VM with initial memory

Volume 1Volume 1Volume 3Volume 3

Image 1Volume 2Volume 2

Snapshot Name Volumes Memory

Active VM Volume 3 Memory 1

Previous Active VM Volume 2

Snapshot 1 Volume 1 Memory 1

Volume 1Volume 1 Volume 2Volume 2

Image 1

Snapshot Name Volumes Memory

Active VM Volume 2

Snapshot 1 Volume 1 Memory 1

Page 29: RAM Snapshots · 2017. 12. 14. · RAM Snapshots Disks snapshot with memory state When running VM that was reverted to RAM snapshot The saved state (memory + disks) is restored TCP

Cloud Open, October 2013 29

RAM snapshot usages

● Create snapshot with memory

● Preview snapshot with memory

● Commit to snapshot with memory

● Stateless VM with initial memory

Volume 1Volume 1Volume 3Volume 3

Image 1Volume 2Volume 2

Snapshot Name Volumes Memory

Active VM Volume 3 Memory 1

Previous Active VM Volume 2

Snapshot 1 Volume 1 Memory 1

Volume 1Volume 1 Volume 3Volume 3

Image 1

Snapshot Name Volumes Memory

Active VM Volume 3 Memory 1

Snapshot 1 Volume 1 Memory 1

Page 30: RAM Snapshots · 2017. 12. 14. · RAM Snapshots Disks snapshot with memory state When running VM that was reverted to RAM snapshot The saved state (memory + disks) is restored TCP

Cloud Open, October 2013 30

RAM snapshot usages

● Create snapshot with memory

● Preview snapshot with memory

● Commit to snapshot with memory

● Stateless VM with initial memory

Snapshot Name Volumes Memory

Active VM Volume 2 Memory 1

Snapshot 1 Volume 1 Memory 1

Volume 1Volume 1 Volume 2Volume 2

Image 1

Snapshot Name Volumes Memory

Active VM Temporary volume

Memory 1

Stateless snapshot Volume 2 Memory 1

Snapshot 1 Volume 1 Memory 1

Volume 1Volume 1 Volume 2Volume 2

Image 1Temporary

volumeTemporary

volume

Page 31: RAM Snapshots · 2017. 12. 14. · RAM Snapshots Disks snapshot with memory state When running VM that was reverted to RAM snapshot The saved state (memory + disks) is restored TCP

Cloud Open, October 2013 31

Run VM – using RAM snapshot

VM suspended?VM suspended?

Resume from hibernation

Resume from hibernation

Yes

Run VM

No

Libvirt restores the memory from the memory Volume with modified VM configuration

Libvirt restores the memory from the memory Volume with modified VM configuration

Engine removes the memory volumes from the Active VM entry

Engine removes the memory volumes from the Active VM entry

Active VMcontains memory?

Active VMcontains memory?

Regular RunRegular Run

NoYes

VDSM loads the properties volumeand modify the VM configuration

VDSM loads the properties volumeand modify the VM configuration

Page 32: RAM Snapshots · 2017. 12. 14. · RAM Snapshots Disks snapshot with memory state When running VM that was reverted to RAM snapshot The saved state (memory + disks) is restored TCP

Cloud Open, October 2013 32

Why do we need to change volumes?

Snapshot Name Volumes Memory

Active VM Volume 3 Memory 1

Snapshot 1 Volume 1 Memory 1

Volume 1Volume 1 Volume 3Volume 3

Image 1

Snapshot Name Volumes Memory

Active VM Volume 2

Snapshot 1 Volume 1 Memory 1

Volume 1Volume 1 Volume 2Volume 2

Image 1

Snapshot Name Volumes Memory

Active VM Volume 1

Volume 1Volume 1

Image 1

When creating the snapshot:

After committing to the snapshot:

Page 33: RAM Snapshots · 2017. 12. 14. · RAM Snapshots Disks snapshot with memory state When running VM that was reverted to RAM snapshot The saved state (memory + disks) is restored TCP

Cloud Open, October 2013 33

Run VM – using RAM snapshot

Engine VDSM Libvirt

Restore

load VM properties

adjust VM properties

virDomainRestoreFlags

Page 34: RAM Snapshots · 2017. 12. 14. · RAM Snapshots Disks snapshot with memory state When running VM that was reverted to RAM snapshot The saved state (memory + disks) is restored TCP

Cloud Open, October 2013 34

Snapshot with memory state in libvirt (2)

● Allows to alter specific portion of the VM configuration● Change active volumes● Change DC & cluster settings

virDomainRestoreFlags (VM, memory _state, xml, flags)

Page 35: RAM Snapshots · 2017. 12. 14. · RAM Snapshots Disks snapshot with memory state When running VM that was reverted to RAM snapshot The saved state (memory + disks) is restored TCP

Cloud Open, October 2013 35

Export/Import VM with RAM snapshots

● RAM snapshots can be exported & imported● Except export/import with copy collapse set

● When copy collapse is set, snapshots are dropped● Including their memory volumes● Except the Active VM entry

Snapshot Volumes Memory

Active VM Volume 3 Memory 2

Snapshot 2 Volume 2 Memory 2

Snapshot 1 Volume 1 Memory 1

Snapshot Volumes Memory

Active VM Volume’ Memory 2’

Page 36: RAM Snapshots · 2017. 12. 14. · RAM Snapshots Disks snapshot with memory state When running VM that was reverted to RAM snapshot The saved state (memory + disks) is restored TCP

Cloud Open, October 2013 36

VM with no snapshots

Page 37: RAM Snapshots · 2017. 12. 14. · RAM Snapshots Disks snapshot with memory state When running VM that was reverted to RAM snapshot The saved state (memory + disks) is restored TCP

Cloud Open, October 2013 37

Create snapshot dialog

VM is not running:

VM is running:

Page 38: RAM Snapshots · 2017. 12. 14. · RAM Snapshots Disks snapshot with memory state When running VM that was reverted to RAM snapshot The saved state (memory + disks) is restored TCP

Cloud Open, October 2013 38

Snapshots creation

Page 39: RAM Snapshots · 2017. 12. 14. · RAM Snapshots Disks snapshot with memory state When running VM that was reverted to RAM snapshot The saved state (memory + disks) is restored TCP

Cloud Open, October 2013 39

Preview snapshot

Page 40: RAM Snapshots · 2017. 12. 14. · RAM Snapshots Disks snapshot with memory state When running VM that was reverted to RAM snapshot The saved state (memory + disks) is restored TCP

Cloud Open, October 2013 40

Commit to RAM snapshot

Page 41: RAM Snapshots · 2017. 12. 14. · RAM Snapshots Disks snapshot with memory state When running VM that was reverted to RAM snapshot The saved state (memory + disks) is restored TCP

Cloud Open, October 2013 41

Run the committed VM

Page 42: RAM Snapshots · 2017. 12. 14. · RAM Snapshots Disks snapshot with memory state When running VM that was reverted to RAM snapshot The saved state (memory + disks) is restored TCP

Cloud Open, October 2013 42

Stateful snapshot – REST API

Page 43: RAM Snapshots · 2017. 12. 14. · RAM Snapshots Disks snapshot with memory state When running VM that was reverted to RAM snapshot The saved state (memory + disks) is restored TCP

Cloud Open, October 2013 43

Stateful snapshot operations – REST API

Preview/Restore:

Create:

Page 44: RAM Snapshots · 2017. 12. 14. · RAM Snapshots Disks snapshot with memory state When running VM that was reverted to RAM snapshot The saved state (memory + disks) is restored TCP

Cloud Open, October 2013 45

THANK YOU !

http://www.ovirt.org/Features/[email protected]@lists.fedorahosted.org

#ovirt irc.oftc.net

[email protected]