1 | # $Id: tstVDCopy.vd 38469 2011-08-16 10:34:32Z vboxsync $
|
---|
2 | #
|
---|
3 | # Storage: Testcase for VDCopy with snapshots and optimizations.
|
---|
4 | #
|
---|
5 |
|
---|
6 | #
|
---|
7 | # Copyright (C) 2011 Oracle Corporation
|
---|
8 | #
|
---|
9 | # This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
10 | # available from http://www.virtualbox.org. This file is free software;
|
---|
11 | # you can redistribute it and/or modify it under the terms of the GNU
|
---|
12 | # General Public License (GPL) as published by the Free Software
|
---|
13 | # Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
14 | # VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
15 | # hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
16 | #
|
---|
17 |
|
---|
18 | # Init I/O RNG for generating random data for writes
|
---|
19 | iorngcreate size=10M mode=manual seed=1234567890
|
---|
20 |
|
---|
21 | # Create source disk and fill data
|
---|
22 | print msg=Creating_Source_Disk
|
---|
23 | createdisk name=source verify=no
|
---|
24 | create disk=source mode=base name=source_base.vdi type=dynamic backend=VDI size=1G
|
---|
25 | io disk=source async=no mode=rnd blocksize=64k off=0-512M size=256M writes=100
|
---|
26 |
|
---|
27 | # Create 1st snapshot
|
---|
28 | print msg=Creating_First_Diff
|
---|
29 | create disk=source mode=diff name=source_diff1.vdi type=dynamic backend=VDI size=1G
|
---|
30 | io disk=source async=no mode=rnd blocksize=64k off=512M-1G size=256M writes=50
|
---|
31 |
|
---|
32 | # Create 2nd snapshot
|
---|
33 | print msg=Creating_Second_Diff
|
---|
34 | create disk=source mode=diff name=source_diff2.vdi type=dynamic backend=VDI size=1G
|
---|
35 | io disk=source async=no mode=rnd blocksize=1M off=0M-1G size=45M writes=100
|
---|
36 |
|
---|
37 | print msg=Creating_Third_Diff
|
---|
38 | create disk=source mode=diff name=source_diff3.vdi type=dynamic backend=VDI size=1G
|
---|
39 | io disk=source async=no mode=rnd blocksize=1M off=0M-1G size=45M writes=100
|
---|
40 |
|
---|
41 | print msg=Creating_Fourth_Diff
|
---|
42 | create disk=source mode=diff name=source_diff4.vdi type=dynamic backend=VDI size=1G
|
---|
43 | io disk=source async=no mode=rnd blocksize=1M off=0M-1G size=45M writes=100
|
---|
44 |
|
---|
45 | # Create destination disk
|
---|
46 | print msg=Creating_Destination_Disk
|
---|
47 | createdisk name=dest verify=no
|
---|
48 |
|
---|
49 | # Copy base image
|
---|
50 | print msg=Copying_Base_Image
|
---|
51 | copy diskfrom=source diskto=dest imagefrom=0 backend=VDI filename=dest_base.vdi
|
---|
52 |
|
---|
53 | print msg=Copying_First_Diff_optimized
|
---|
54 | copy diskfrom=source diskto=dest imagefrom=1 backend=VDI filename=dest_diff1.vdi fromsame=0 tosame=0
|
---|
55 |
|
---|
56 | print msg=Copying_Second_Diff_optimized
|
---|
57 | copy diskfrom=source diskto=dest imagefrom=2 backend=VDI filename=dest_diff2.vdi fromsame=1 tosame=1
|
---|
58 | copy diskfrom=source diskto=dest imagefrom=3 backend=VDI filename=dest_diff3.vdi fromsame=2 tosame=2
|
---|
59 | copy diskfrom=source diskto=dest imagefrom=4 backend=VDI filename=dest_diff4.vdi fromsame=3 tosame=3
|
---|
60 |
|
---|
61 | print msg=Comparing_Disks
|
---|
62 | comparedisks disk1=source disk2=dest
|
---|
63 |
|
---|
64 | printfilesize disk=source image=0
|
---|
65 | printfilesize disk=source image=1
|
---|
66 | printfilesize disk=source image=2
|
---|
67 | printfilesize disk=source image=3
|
---|
68 | printfilesize disk=source image=4
|
---|
69 |
|
---|
70 | printfilesize disk=dest image=0
|
---|
71 | printfilesize disk=dest image=1
|
---|
72 | printfilesize disk=dest image=2
|
---|
73 | printfilesize disk=dest image=3
|
---|
74 | printfilesize disk=dest image=4
|
---|
75 |
|
---|
76 | # Cleanup
|
---|
77 | print msg=Cleaning_up
|
---|
78 | close disk=dest mode=single delete=yes
|
---|
79 | close disk=dest mode=single delete=yes
|
---|
80 | close disk=dest mode=single delete=yes
|
---|
81 |
|
---|
82 | close disk=source mode=single delete=yes
|
---|
83 | close disk=source mode=single delete=yes
|
---|
84 | close disk=source mode=single delete=yes
|
---|
85 | destroydisk name=source
|
---|
86 | destroydisk name=dest
|
---|
87 |
|
---|
88 | iorngdestroy
|
---|
89 |
|
---|