[pve-devel] [PATCH qemu-server v2 3/3] add new tests for 'runningmachine' and rollback

Dominik Csapak d.csapak at proxmox.com
Fri Sep 14 14:08:44 CEST 2018


Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 test/snapshot-expected/create/qemu-server/301.conf | 33 ++++++++++++++++++++
 test/snapshot-expected/create/qemu-server/302.conf | 33 ++++++++++++++++++++
 .../rollback/qemu-server/301.conf                  | 33 ++++++++++++++++++++
 .../rollback/qemu-server/302.conf                  | 35 ++++++++++++++++++++++
 test/snapshot-input/create/qemu-server/301.conf    | 13 ++++++++
 test/snapshot-input/create/qemu-server/302.conf    | 13 ++++++++
 test/snapshot-input/rollback/qemu-server/301.conf  | 33 ++++++++++++++++++++
 test/snapshot-input/rollback/qemu-server/302.conf  | 34 +++++++++++++++++++++
 test/snapshot-test.pm                              |  8 +++++
 9 files changed, 235 insertions(+)
 create mode 100644 test/snapshot-expected/create/qemu-server/301.conf
 create mode 100644 test/snapshot-expected/create/qemu-server/302.conf
 create mode 100644 test/snapshot-expected/rollback/qemu-server/301.conf
 create mode 100644 test/snapshot-expected/rollback/qemu-server/302.conf
 create mode 100644 test/snapshot-input/create/qemu-server/301.conf
 create mode 100644 test/snapshot-input/create/qemu-server/302.conf
 create mode 100644 test/snapshot-input/rollback/qemu-server/301.conf
 create mode 100644 test/snapshot-input/rollback/qemu-server/302.conf

diff --git a/test/snapshot-expected/create/qemu-server/301.conf b/test/snapshot-expected/create/qemu-server/301.conf
new file mode 100644
index 0000000..9c49b1d
--- /dev/null
+++ b/test/snapshot-expected/create/qemu-server/301.conf
@@ -0,0 +1,33 @@
+bootdisk: ide0
+cores: 4
+ide0: local:snapshotable-disk-1,discard=on,size=32G
+ide2: none,media=cdrom
+machine: q35
+memory: 8192
+name: win
+net0: e1000=12:34:56:78:90:12,bridge=somebr0,firewall=1
+numa: 0
+ostype: win7
+parent: test
+smbios1: uuid=01234567-890a-bcde-f012-34567890abcd
+sockets: 1
+vga: qxl
+
+[test]
+#test comment
+bootdisk: ide0
+cores: 4
+ide0: local:snapshotable-disk-1,discard=on,size=32G
+ide2: none,media=cdrom
+machine: q35
+memory: 8192
+name: win
+net0: e1000=12:34:56:78:90:12,bridge=somebr0,firewall=1
+numa: 0
+ostype: win7
+runningmachine: somemachine
+smbios1: uuid=01234567-890a-bcde-f012-34567890abcd
+snaptime: 1234567890
+sockets: 1
+vga: qxl
+vmstate: somestorage:state-volume
diff --git a/test/snapshot-expected/create/qemu-server/302.conf b/test/snapshot-expected/create/qemu-server/302.conf
new file mode 100644
index 0000000..9c49b1d
--- /dev/null
+++ b/test/snapshot-expected/create/qemu-server/302.conf
@@ -0,0 +1,33 @@
+bootdisk: ide0
+cores: 4
+ide0: local:snapshotable-disk-1,discard=on,size=32G
+ide2: none,media=cdrom
+machine: q35
+memory: 8192
+name: win
+net0: e1000=12:34:56:78:90:12,bridge=somebr0,firewall=1
+numa: 0
+ostype: win7
+parent: test
+smbios1: uuid=01234567-890a-bcde-f012-34567890abcd
+sockets: 1
+vga: qxl
+
+[test]
+#test comment
+bootdisk: ide0
+cores: 4
+ide0: local:snapshotable-disk-1,discard=on,size=32G
+ide2: none,media=cdrom
+machine: q35
+memory: 8192
+name: win
+net0: e1000=12:34:56:78:90:12,bridge=somebr0,firewall=1
+numa: 0
+ostype: win7
+runningmachine: somemachine
+smbios1: uuid=01234567-890a-bcde-f012-34567890abcd
+snaptime: 1234567890
+sockets: 1
+vga: qxl
+vmstate: somestorage:state-volume
diff --git a/test/snapshot-expected/rollback/qemu-server/301.conf b/test/snapshot-expected/rollback/qemu-server/301.conf
new file mode 100644
index 0000000..c521154
--- /dev/null
+++ b/test/snapshot-expected/rollback/qemu-server/301.conf
@@ -0,0 +1,33 @@
+agent: 1
+bootdisk: ide0
+cores: 4
+ide0: local:snapshotable-disk-1,discard=on,size=32G
+ide2: none,media=cdrom
+memory: 8192
+name: win
+net0: e1000=12:34:56:78:90:12,bridge=somebr0,firewall=1
+numa: 0
+ostype: win7
+parent: test
+smbios1: uuid=01234567-890a-bcde-f012-34567890abcd
+sockets: 1
+vga: qxl
+
+[test]
+#test comment
+agent: 1
+bootdisk: ide0
+cores: 4
+ide0: local:snapshotable-disk-1,discard=on,size=32G
+ide2: none,media=cdrom
+machine: somemachine
+memory: 8192
+name: win
+net0: e1000=12:34:56:78:90:12,bridge=somebr0,firewall=1
+numa: 0
+ostype: win7
+smbios1: uuid=01234567-890a-bcde-f012-34567890abcd
+snaptime: 1234567890
+sockets: 1
+vga: qxl
+vmstate: somestorage:state-volume
diff --git a/test/snapshot-expected/rollback/qemu-server/302.conf b/test/snapshot-expected/rollback/qemu-server/302.conf
new file mode 100644
index 0000000..828e8b0
--- /dev/null
+++ b/test/snapshot-expected/rollback/qemu-server/302.conf
@@ -0,0 +1,35 @@
+agent: 1
+bootdisk: ide0
+cores: 4
+ide0: local:snapshotable-disk-1,discard=on,size=32G
+ide2: none,media=cdrom
+machine: q35
+memory: 8192
+name: win
+net0: e1000=12:34:56:78:90:12,bridge=somebr0,firewall=1
+numa: 0
+ostype: win7
+parent: test
+smbios1: uuid=01234567-890a-bcde-f012-34567890abcd
+sockets: 1
+vga: qxl
+
+[test]
+#test comment
+agent: 1
+bootdisk: ide0
+cores: 4
+ide0: local:snapshotable-disk-1,discard=on,size=32G
+ide2: none,media=cdrom
+machine: q35
+memory: 8192
+name: win
+net0: e1000=12:34:56:78:90:12,bridge=somebr0,firewall=1
+numa: 0
+ostype: win7
+runningmachine: somemachine
+smbios1: uuid=01234567-890a-bcde-f012-34567890abcd
+snaptime: 1234567890
+sockets: 1
+vga: qxl
+vmstate: somestorage:state-volume
diff --git a/test/snapshot-input/create/qemu-server/301.conf b/test/snapshot-input/create/qemu-server/301.conf
new file mode 100644
index 0000000..2731bd1
--- /dev/null
+++ b/test/snapshot-input/create/qemu-server/301.conf
@@ -0,0 +1,13 @@
+bootdisk: ide0
+cores: 4
+ide0: local:snapshotable-disk-1,discard=on,size=32G
+ide2: none,media=cdrom
+machine: q35
+memory: 8192
+name: win
+net0: e1000=12:34:56:78:90:12,bridge=somebr0,firewall=1
+numa: 0
+ostype: win7
+smbios1: uuid=01234567-890a-bcde-f012-34567890abcd
+sockets: 1
+vga: qxl
diff --git a/test/snapshot-input/create/qemu-server/302.conf b/test/snapshot-input/create/qemu-server/302.conf
new file mode 100644
index 0000000..2731bd1
--- /dev/null
+++ b/test/snapshot-input/create/qemu-server/302.conf
@@ -0,0 +1,13 @@
+bootdisk: ide0
+cores: 4
+ide0: local:snapshotable-disk-1,discard=on,size=32G
+ide2: none,media=cdrom
+machine: q35
+memory: 8192
+name: win
+net0: e1000=12:34:56:78:90:12,bridge=somebr0,firewall=1
+numa: 0
+ostype: win7
+smbios1: uuid=01234567-890a-bcde-f012-34567890abcd
+sockets: 1
+vga: qxl
diff --git a/test/snapshot-input/rollback/qemu-server/301.conf b/test/snapshot-input/rollback/qemu-server/301.conf
new file mode 100644
index 0000000..c521154
--- /dev/null
+++ b/test/snapshot-input/rollback/qemu-server/301.conf
@@ -0,0 +1,33 @@
+agent: 1
+bootdisk: ide0
+cores: 4
+ide0: local:snapshotable-disk-1,discard=on,size=32G
+ide2: none,media=cdrom
+memory: 8192
+name: win
+net0: e1000=12:34:56:78:90:12,bridge=somebr0,firewall=1
+numa: 0
+ostype: win7
+parent: test
+smbios1: uuid=01234567-890a-bcde-f012-34567890abcd
+sockets: 1
+vga: qxl
+
+[test]
+#test comment
+agent: 1
+bootdisk: ide0
+cores: 4
+ide0: local:snapshotable-disk-1,discard=on,size=32G
+ide2: none,media=cdrom
+machine: somemachine
+memory: 8192
+name: win
+net0: e1000=12:34:56:78:90:12,bridge=somebr0,firewall=1
+numa: 0
+ostype: win7
+smbios1: uuid=01234567-890a-bcde-f012-34567890abcd
+snaptime: 1234567890
+sockets: 1
+vga: qxl
+vmstate: somestorage:state-volume
diff --git a/test/snapshot-input/rollback/qemu-server/302.conf b/test/snapshot-input/rollback/qemu-server/302.conf
new file mode 100644
index 0000000..518c954
--- /dev/null
+++ b/test/snapshot-input/rollback/qemu-server/302.conf
@@ -0,0 +1,34 @@
+agent: 1
+bootdisk: ide0
+cores: 4
+ide0: local:snapshotable-disk-1,discard=on,size=32G
+ide2: none,media=cdrom
+memory: 8192
+name: win
+net0: e1000=12:34:56:78:90:12,bridge=somebr0,firewall=1
+numa: 0
+ostype: win7
+parent: test
+smbios1: uuid=01234567-890a-bcde-f012-34567890abcd
+sockets: 1
+vga: qxl
+
+[test]
+#test comment
+agent: 1
+bootdisk: ide0
+cores: 4
+ide0: local:snapshotable-disk-1,discard=on,size=32G
+ide2: none,media=cdrom
+machine: q35
+memory: 8192
+name: win
+net0: e1000=12:34:56:78:90:12,bridge=somebr0,firewall=1
+numa: 0
+ostype: win7
+runningmachine: somemachine
+smbios1: uuid=01234567-890a-bcde-f012-34567890abcd
+snaptime: 1234567890
+sockets: 1
+vga: qxl
+vmstate: somestorage:state-volume
diff --git a/test/snapshot-test.pm b/test/snapshot-test.pm
index 8988942..c95e7f3 100644
--- a/test/snapshot-test.pm
+++ b/test/snapshot-test.pm
@@ -528,6 +528,8 @@ printf("Expected error for snapshot_create when Qemu mon command 'savevm-start'
 testcase_create("203", "test", 0, "test comment", "savevm-start disabled\n\n");
 $vm_mon->{savevm_start} = 1;
 
+printf("Successful snapshot_create with no existing snapshots but set machine type\n");
+testcase_create("301", "test", 1, "test comment", "", { "local:snapshotable-disk-1" => "test" });
 
 $nodename = "delete";
 printf("\n");
@@ -611,4 +613,10 @@ testcase_rollback("206", "test", "volume_rollback_is_possible failed\n");
 printf("Expected error for snapshot_rollback with mp rollback failure (results in inconsistent state)\n");
 testcase_rollback("207", "test", "volume snapshot rollback disabled\n", { "local:snapshotable-disk-1" => "test", "local:snapshotable-disk-2" => "test" });
 
+printf("Successful snapshot_rollback with saved vmstate and machine config only in snapshot\n");
+testcase_rollback("301", "test", "", { "local:snapshotable-disk-1" => "test" });
+
+printf("Successful snapshot_rollback with saved vmstate and machine config and runningmachine \n");
+testcase_rollback("302", "test", "", { "local:snapshotable-disk-1" => "test" });
+
 done_testing();
-- 
2.11.0





More information about the pve-devel mailing list