1 | # $Id: tstVDCopy.vd 38204 2011-07-27 16:14:59Z 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=512M
|
---|
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=512M
|
---|
30 | io disk=source async=no mode=rnd blocksize=64k off=0M-512M 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=512M
|
---|
35 | io disk=source async=no mode=rnd blocksize=64k off=0M-512M size=128M writes=25
|
---|
36 |
|
---|
37 | # Create destination disk
|
---|
38 | print msg=Creating_Destination_Disk
|
---|
39 | createdisk name=dest verify=no
|
---|
40 |
|
---|
41 | # Copy base image
|
---|
42 | print msg=Copying_Base_Image
|
---|
43 | copy diskfrom=source diskto=dest imagefrom=0 backend=VDI filename=dest_base.vdi
|
---|
44 |
|
---|
45 | print msg=Copying_First_Diff_optimized
|
---|
46 | copy diskfrom=source diskto=dest imagefrom=1 backend=VDI filename=dest_diff1.vdi fromsame=0 tosame=0
|
---|
47 |
|
---|
48 | print msg=Copying_Second_Diff_optimized
|
---|
49 | copy diskfrom=source diskto=dest imagefrom=2 backend=VDI filename=dest_diff2.vdi fromsame=1 tosame=1
|
---|
50 |
|
---|
51 | print msg=Comparing_Disks
|
---|
52 | comparedisks disk1=source disk2=dest
|
---|
53 |
|
---|
54 | # Cleanup
|
---|
55 | print msg=Cleaning_up
|
---|
56 | close disk=dest mode=single delete=yes
|
---|
57 | close disk=dest mode=single delete=yes
|
---|
58 | close disk=dest mode=single delete=yes
|
---|
59 |
|
---|
60 | # Test unoptimized copying now.
|
---|
61 | print msg=Copy_Source_into_base_image
|
---|
62 | copy diskfrom=source diskto=dest imagefrom=2 backend=VDI filename=dest_base.vdi
|
---|
63 | print msg=Comparing_Disks
|
---|
64 | comparedisks disk1=source disk2=dest
|
---|
65 |
|
---|
66 | print msg=Final_Cleanup
|
---|
67 | close disk=source mode=single delete=yes
|
---|
68 | close disk=source mode=single delete=yes
|
---|
69 | close disk=source mode=single delete=yes
|
---|
70 | close disk=dest mode=single delete=yes
|
---|
71 | destroydisk name=source
|
---|
72 | destroydisk name=dest
|
---|
73 |
|
---|
74 | iorngdestroy
|
---|
75 |
|
---|