Two quorum patches for the block queue, v2.
-----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQEcBAABCAAGBQJW6tDLAAoJEDuxQgLoOKytAisH/3nPs+SCVD9Vd936wx0o1+dG 2sWwR2QirfbK98+/XGIuW77qXzsrKbaku+KqCvQ8/R6zTKENblEm+EJuCqcvif/f 6SktylvNlyKPuKFqCY9mHbaC2tiFYUsmH50afrMegu0dO9ZM4DnRcgAqJKrGeHVr U3kbLjmTYnciv3YJ4YgWyKkY++IuZXT0ElS2lasOxPa8ntQhFSQgRWdjQE0RZyEC wB5gJQYtwOdc6++Y/cGQgnoY/Nz24ggAnQ3OaDJSH4GdWjNUKn02KaZhcBw+MgfU lnfTFpPJ57htWuP3Pbi69dh+qpdkU9U+wD6TXecrnLdAovUf8m+/M/x76LvU9ro= =nG9k -----END PGP SIGNATURE----- Merge remote-tracking branch 'mreitz/tags/pull-block-for-kevin-2016-03-17-v2' into queue-block Two quorum patches for the block queue, v2. # gpg: Signature made Thu Mar 17 16:44:11 2016 CET using RSA key ID E838ACAD # gpg: Good signature from "Max Reitz <mreitz@redhat.com>" * mreitz/tags/pull-block-for-kevin-2016-03-17-v2: iotests: Test QUORUM_REPORT_BAD in fifo mode quorum: Emit QUORUM_REPORT_BAD for reads in fifo mode Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
commit
361dca7a5a
@ -284,9 +284,17 @@ static void quorum_aio_cb(void *opaque, int ret)
|
||||
QuorumChildRequest *sacb = opaque;
|
||||
QuorumAIOCB *acb = sacb->parent;
|
||||
BDRVQuorumState *s = acb->common.bs->opaque;
|
||||
QuorumOpType type;
|
||||
bool rewrite = false;
|
||||
|
||||
if (ret == 0) {
|
||||
acb->success_count++;
|
||||
} else {
|
||||
QuorumOpType type;
|
||||
type = acb->is_read ? QUORUM_OP_TYPE_READ : QUORUM_OP_TYPE_WRITE;
|
||||
quorum_report_bad(type, acb->sector_num, acb->nb_sectors,
|
||||
sacb->aiocb->bs->node_name, ret);
|
||||
}
|
||||
|
||||
if (acb->is_read && s->read_pattern == QUORUM_READ_PATTERN_FIFO) {
|
||||
/* We try to read next child in FIFO order if we fail to read */
|
||||
if (ret < 0 && (acb->child_iter + 1) < s->num_children) {
|
||||
@ -303,15 +311,8 @@ static void quorum_aio_cb(void *opaque, int ret)
|
||||
return;
|
||||
}
|
||||
|
||||
type = acb->is_read ? QUORUM_OP_TYPE_READ : QUORUM_OP_TYPE_WRITE;
|
||||
sacb->ret = ret;
|
||||
acb->count++;
|
||||
if (ret == 0) {
|
||||
acb->success_count++;
|
||||
} else {
|
||||
quorum_report_bad(type, acb->sector_num, acb->nb_sectors,
|
||||
sacb->aiocb->bs->node_name, ret);
|
||||
}
|
||||
assert(acb->count <= s->num_children);
|
||||
assert(acb->success_count <= s->num_children);
|
||||
if (acb->count < s->num_children) {
|
||||
|
@ -35,6 +35,7 @@ sector_size = 512
|
||||
offset = 10
|
||||
|
||||
class TestQuorumEvents(iotests.QMPTestCase):
|
||||
read_pattern = 'quorum'
|
||||
|
||||
def create_blkdebug_file(self, blkdebug_file, bad_sector):
|
||||
file = open(blkdebug_file, 'w')
|
||||
@ -48,6 +49,7 @@ sector = "%d"
|
||||
|
||||
def setUp(self):
|
||||
driveopts = ['driver=quorum', 'vote-threshold=2']
|
||||
driveopts.append('read-pattern=%s' % self.read_pattern)
|
||||
for i in range(len(imgs)):
|
||||
iotests.qemu_img('create', '-f', iotests.imgfmt, imgs[i], '1M')
|
||||
self.create_blkdebug_file(img_conf[i], i + offset)
|
||||
@ -112,7 +114,11 @@ sector = "%d"
|
||||
self.vm.hmp_qemu_io("drive0", "aio_read %d %d" %
|
||||
((offset + i) * sector_size, sector_size))
|
||||
self.vm.qtest("clock_step %d" % delay)
|
||||
self.do_check_event('img%d' % i, offset + i)
|
||||
# In fifo mode only errors in the first child are detected
|
||||
if i > 0 and self.read_pattern == 'fifo':
|
||||
self.do_check_event(None)
|
||||
else:
|
||||
self.do_check_event('img%d' % i, offset + i)
|
||||
|
||||
# I/O errors in different children: all events are emitted
|
||||
delay = 2 * event_rate
|
||||
@ -120,10 +126,17 @@ sector = "%d"
|
||||
self.vm.hmp_qemu_io("drive0", "aio_read %d %d" %
|
||||
((offset + i) * sector_size, sector_size))
|
||||
self.vm.qtest("clock_step %d" % delay)
|
||||
self.do_check_event('img%d' % i, offset + i)
|
||||
# In fifo mode only errors in the first child are detected
|
||||
if i > 0 and self.read_pattern == 'fifo':
|
||||
self.do_check_event(None)
|
||||
else:
|
||||
self.do_check_event('img%d' % i, offset + i)
|
||||
|
||||
# No more pending events
|
||||
self.do_check_event(None)
|
||||
|
||||
class TestFifoQuorumEvents(TestQuorumEvents):
|
||||
read_pattern = 'fifo'
|
||||
|
||||
if __name__ == '__main__':
|
||||
iotests.main(supported_fmts=["raw"])
|
||||
|
@ -1,5 +1,5 @@
|
||||
.
|
||||
..
|
||||
----------------------------------------------------------------------
|
||||
Ran 1 tests
|
||||
Ran 2 tests
|
||||
|
||||
OK
|
||||
|
Loading…
Reference in New Issue
Block a user