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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
|
id = 1005
title = "blockdev-del doesn't work after blockdev-backup with incremental, which using dirty-bitmap"
state = "closed"
created_at = "2022-04-27T09:16:38.116Z"
closed_at = "2022-04-28T07:45:07.102Z"
labels = []
url = "https://gitlab.com/qemu-project/qemu/-/issues/1005"
host-os = "Ubuntu 20.04.2 LTS"
host-arch = "amd64"
qemu-version = "QEMU emulator version 6.1.0"
guest-os = "CentOS Linux release 7.9.2009"
guest-arch = "amd64"
description = """After incremental backup with bitmap, blockdev-del doesn't work at target node.
Because of this, incremental backup cannot rebase to base node.
I refered this. https://qemu-project.gitlab.io/qemu/interop/bitmaps.html#example-incremental-push-backups-without-backing-files"""
reproduce = """1. `blockdev-add` incremental backup node
```
echo '{"execute":"qmp_capabilities"}{"execute":"blockdev-add","arguments":{"driver":"qcow2","node-name":"incre0","file":{"driver":"file","filename":"/mnt/7b12fe9c-fa0f-4f2a-82b1-3a6cd4e15ae8/temp/incre0.qcow2"}}}' | nc -U /mnt/7b12fe9c-fa0f-4f2a-82b1-3a6cd4e15ae8/temp/qmp.sock -N
{
"return": {
}
}
```
2. `blockdev-backup` with `vda` to target `incre0` node
```
echo '{"execute":"qmp_capabilities"}{"execute":"blockdev-backup", "arguments": {"device": "vda", "bitmap":"bitmap0", "target": "incre0", "sync": "incremental", "job-id": "incre0-job", "speed": 536870912}}' | nc -U /mnt/7b12fe9c-fa0f-4f2a-82b1-3a6cd4e15ae8/temp/qmp.sock -N
{
"timestamp": {
"seconds": 1651050066,
"microseconds": 848370
},
"event": "JOB_STATUS_CHANGE",
"data": {
"status": "created",
"id": "incre0-job"
}
}
{
"timestamp": {
"seconds": 1651050066,
"microseconds": 848431
},
"event": "JOB_STATUS_CHANGE",
"data": {
"status": "running",
"id": "incre0-job"
}
}
{
"timestamp": {
"seconds": 1651050066,
"microseconds": 848464
},
"event": "JOB_STATUS_CHANGE",
"data": {
"status": "paused",
"id": "incre0-job"
}
}
{
"timestamp": {
"seconds": 1651050066,
"microseconds": 848485
},
"event": "JOB_STATUS_CHANGE",
"data": {
"status": "running",
"id": "incre0-job"
}
}
{
"return": {
}
}
```
3. `query-block-jobs` check `incre0-job` is done
```
echo '{"execute":"qmp_capabilities"}{"execute":"query-block-jobs"}' | nc -U /mnt/7b12fe9c-fa0f-4f2a-82b1-3a6cd4e15ae8/temp/qmp.sock -N
{
"return": {
}
}
{
"return": [
]
}
```
4. To release write lock (need to rebase in incre0.qcow2), `blockdev-del`
```
echo '{"execute":"qmp_capabilities"}{"execute":"blockdev-del","arguments":{"node-name":"incre0"}' | nc -U /mnt/7b12fe9c-fa0f-4f2a-82b1-3a6cd4e15ae8/temp/qmp.sock -N
{
"return": {
}
}
```
5. `qemu-img rebase`
```
qemu-img rebase -b base.qcow2 -u incre0.qcow2
qemu-img: Could not open 'incre0.qcow2': Failed to get "write" lock
Is another process using the image [incre0.qcow2]?
```
6. check `query-named-block-nodes` after `blockdev-del`
```
{
"return": [
{
"iops_rd": 0,
"detect_zeroes": "off",
"image": {
"virtual-size": 53687091200,
"filename": "/mnt/7b12fe9c-fa0f-4f2a-82b1-3a6cd4e15ae8/temp/incre0.qcow2",
"cluster-size": 65536,
"format": "qcow2",
"actual-size": 241340416,
"format-specific": {
"type": "qcow2",
"data": {
"compat": "1.1",
"compression-type": "zlib",
"lazy-refcounts": false,
"refcount-bits": 16,
"corrupt": false,
"extended-l2": false
}
},
"dirty-flag": false
},
"iops_wr": 0,
"ro": false,
"node-name": "incre0",
"backing_file_depth": 0,
"drv": "qcow2",
"iops": 0,
"bps_wr": 0,
"write_threshold": 0,
"encrypted": false,
"bps": 0,
"bps_rd": 0,
"cache": {
"no-flush": false,
"direct": false,
"writeback": true
},
"file": "/mnt/7b12fe9c-fa0f-4f2a-82b1-3a6cd4e15ae8/temp/incre0.qcow2"
},
{
"iops_rd": 0,
"detect_zeroes": "off",
"image": {
"virtual-size": 240451584,
"filename": "/mnt/7b12fe9c-fa0f-4f2a-82b1-3a6cd4e15ae8/temp/incre0.qcow2",
"format": "file",
"actual-size": 241340416,
"dirty-flag": false
},
"iops_wr": 0,
"ro": false,
"node-name": "#block412",
"backing_file_depth": 0,
"drv": "file",
"iops": 0,
"bps_wr": 0,
"write_threshold": 0,
"encrypted": false,
"bps": 0,
"bps_rd": 0,
"cache": {
"no-flush": false,
"direct": false,
"writeback": true
},
"file": "/mnt/7b12fe9c-fa0f-4f2a-82b1-3a6cd4e15ae8/temp/incre0.qcow2"
},
......
]
}
```"""
additional = """"""
|