forked from autotest/virt-test
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlibvirt_storage.py
110 lines (77 loc) · 2.52 KB
/
libvirt_storage.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
"""
Classes and functions to handle block/disk images for libvirt.
This exports:
- two functions for get image/blkdebug filename
- class for image operates and basic parameters
"""
import storage
class QemuImg(storage.QemuImg):
"""
libvirt class for handling operations of disk/block images.
"""
def __init__(self, params, root_dir, tag):
"""
Init the default value for image object.
@param params: Dictionary containing the test parameters.
@param root_dir: Base directory for relative filenames.
@param tag: Image tag defined in parameter images.
"""
storage.QemuImg(params, root_dir, tag)
# Please init image_cmd for libvirt in this class
# self.image_cmd =
def create(self, params):
"""
Create an image.
@param params: Dictionary containing the test parameters.
@note: params should contain:
"""
raise NotImplementedError
def convert(self, params, root_dir):
"""
Convert image
@param params: A dict
@param root_dir: dir for save the convert image
@note: params should contain:
"""
raise NotImplementedError
def rebase(self, params):
"""
Rebase image
@param params: A dict
@note: params should contain:
"""
raise NotImplementedError
def commit(self):
"""
Commit image to it's base file
"""
raise NotImplementedError
def snapshot_create(self):
"""
Create a snapshot image.
@note: params should contain:
"""
raise NotImplementedError
def snapshot_del(self, blkdebug_cfg=""):
"""
Delete a snapshot image.
@param blkdebug_cfg: The configure file of blkdebug
@note: params should contain:
snapshot_image_name -- the name of snapshot image file
"""
raise NotImplementedError
def remove(self):
"""
Remove an image file.
@note: params should contain:
"""
raise NotImplementedError
def check_image(self, params, root_dir):
"""
Check an image using the appropriate tools for each virt backend.
@param params: Dictionary containing the test parameters.
@param root_dir: Base directory for relative filenames.
@note: params should contain:
@raise VMImageCheckError: In case qemu-img check fails on the image.
"""
raise NotImplementedError