如何在XenServer上使用命令行生成快照,恢复VM快照

查看虚拟机的UUID

使用xe VM-LIST列出所有可用VM,记下需要生成快照的VM的UUID:

# xe vm-list
uuid ( RO)           : 7371124f-7d4d-66b7-cbc7-a98b1457543e
     name-label ( RW): Debian Jessie 8.5
    power-state ( RO): halted

uuid ( RO)           : bad8e456-df88-435d-ba12-3f0f6e54b2c6
     name-label ( RW): Control domain on host: xenserver
    power-state ( RO): running

生成快照

假设我们要创建快照的虚拟机的UUID是“7371124F-7D4D-66B7-CBC7-A98B1457543E”。

使用下面命令创建一个新快照“Debian Jessie 8.5-Snapshot”

# xe vm-snapshot new-name-label="Debian Jessie 8.5-Snapshot" vm=7371124f-7d4d-66b7-cbc7-a98b1457543e
f100447b-09a0-7b4c-31c9-36b970ecc9dd

查看快照:

# xe snapshot-list name-label="Debian Jessie 8.5-Snapshot"
uuid ( RO)                : f100447b-09a0-7b4c-31c9-36b970ecc9dd
          name-label ( RW): Debian Jessie 8.5-Snapshot
    name-description ( RW): Installed via xe CLI

从快照恢复

现在我们可以从快照恢复。
请注意,VM将会被停止:

# xe snapshot-revert snapshot-uuid=f100447b-09a0-7b4c-31c9-36b970ecc9dd
日期:2020-07-07 20:56:37 来源:oir作者:oir