mirror of
https://github.com/xemu-project/xemu.git
synced 2025-02-25 23:15:49 +00:00
NBD patches for 2020-07-13
- fix off-by-one truncation in corner-case name display - use fcntl correctly - iotest cleanups that enable testing an upcoming fix for NBD close -----BEGIN PGP SIGNATURE----- iQEzBAABCAAdFiEEccLMIrHEYCkn0vOqp6FrSiUnQ2oFAl8Ma5cACgkQp6FrSiUn Q2pnlQf/SK5NsWoUUuo9ufAoSRHEWcYr5yGffqMQGB3n0qTMi+8mTIRov09MvIuN uKX5nsGlFlYeVYFIo6+wr0LAl1IZClmbzKUW/NeiBP7fc6TMdmEXFyBq6iFMFHjm F5h11jCMd3E0jN51KVBpiL6dtBvdGiJWdMYr55N6knu0+465505YCeldcs4eLJct fc9VxWIhN8apuAYuli2gn4eZQju46OsWhCvQDqZo5EvTLBTXN5qvkU531FkceJkZ lnHf9JRyJ2Z5QcgRWklZaORWHDIOgrnIsAisgEC2pn6pt3fAhEjP1JzKsdBKWBT8 7YzApIHYqixqTyEnIO4aKADnfwysYw== =6kLs -----END PGP SIGNATURE----- Merge remote-tracking branch 'remotes/ericb/tags/pull-nbd-2020-07-13' into staging NBD patches for 2020-07-13 - fix off-by-one truncation in corner-case name display - use fcntl correctly - iotest cleanups that enable testing an upcoming fix for NBD close # gpg: Signature made Mon 13 Jul 2020 15:11:35 BST # gpg: using RSA key 71C2CC22B1C4602927D2F3AAA7A16B4A2527436A # gpg: Good signature from "Eric Blake <eblake@redhat.com>" [full] # gpg: aka "Eric Blake (Free Software Programmer) <ebb9@byu.net>" [full] # gpg: aka "[jpeg image of size 6874]" [full] # Primary key fingerprint: 71C2 CC22 B1C4 6029 27D2 F3AA A7A1 6B4A 2527 436A * remotes/ericb/tags/pull-nbd-2020-07-13: iotests.py: filter_testfiles(): filter SOCK_DIR too iotests.py: QemuIoInteractive: print output on failure iotests: QemuIoInteractive: use qemu_io_args_no_fmt hax: Fix setting of FD_CLOEXEC nbd: Avoid off-by-one in long export name truncation Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
commit
1a53dfee92
@ -2002,7 +2002,7 @@ static void nbd_refresh_filename(BlockDriverState *bs)
|
||||
len = snprintf(bs->exact_filename, sizeof(bs->exact_filename),
|
||||
"nbd://%s:%s", host, port);
|
||||
}
|
||||
if (len > sizeof(bs->exact_filename)) {
|
||||
if (len >= sizeof(bs->exact_filename)) {
|
||||
/* Name is too long to represent exactly, so leave it empty. */
|
||||
bs->exact_filename[0] = '\0';
|
||||
}
|
||||
|
@ -23,7 +23,7 @@ hax_fd hax_mod_open(void)
|
||||
fprintf(stderr, "Failed to open the hax module\n");
|
||||
}
|
||||
|
||||
fcntl(fd, F_SETFD, FD_CLOEXEC);
|
||||
qemu_set_cloexec(fd);
|
||||
|
||||
return fd;
|
||||
}
|
||||
@ -147,7 +147,7 @@ hax_fd hax_host_open_vm(struct hax_state *hax, int vm_id)
|
||||
fd = open(vm_name, O_RDWR);
|
||||
g_free(vm_name);
|
||||
|
||||
fcntl(fd, F_SETFD, FD_CLOEXEC);
|
||||
qemu_set_cloexec(fd);
|
||||
|
||||
return fd;
|
||||
}
|
||||
@ -200,7 +200,7 @@ hax_fd hax_host_open_vcpu(int vmid, int vcpuid)
|
||||
if (fd < 0) {
|
||||
fprintf(stderr, "Failed to open the vcpu devfs\n");
|
||||
}
|
||||
fcntl(fd, F_SETFD, FD_CLOEXEC);
|
||||
qemu_set_cloexec(fd);
|
||||
return fd;
|
||||
}
|
||||
|
||||
|
@ -212,12 +212,18 @@ def get_virtio_scsi_device():
|
||||
|
||||
class QemuIoInteractive:
|
||||
def __init__(self, *args):
|
||||
self.args = qemu_io_args + list(args)
|
||||
self.args = qemu_io_args_no_fmt + list(args)
|
||||
self._p = subprocess.Popen(self.args, stdin=subprocess.PIPE,
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.STDOUT,
|
||||
universal_newlines=True)
|
||||
assert self._p.stdout.read(9) == 'qemu-io> '
|
||||
out = self._p.stdout.read(9)
|
||||
if out != 'qemu-io> ':
|
||||
# Most probably qemu-io just failed to start.
|
||||
# Let's collect the whole output and exit.
|
||||
out += self._p.stdout.read()
|
||||
self._p.wait(timeout=1)
|
||||
raise ValueError(out)
|
||||
|
||||
def close(self):
|
||||
self._p.communicate('q\n')
|
||||
@ -339,8 +345,9 @@ def filter_qmp(qmsg, filter_fn):
|
||||
return qmsg
|
||||
|
||||
def filter_testfiles(msg):
|
||||
prefix = os.path.join(test_dir, "%s-" % (os.getpid()))
|
||||
return msg.replace(prefix, 'TEST_DIR/PID-')
|
||||
pref1 = os.path.join(test_dir, "%s-" % (os.getpid()))
|
||||
pref2 = os.path.join(sock_dir, "%s-" % (os.getpid()))
|
||||
return msg.replace(pref1, 'TEST_DIR/PID-').replace(pref2, 'SOCK_DIR/PID-')
|
||||
|
||||
def filter_qmp_testfiles(qmsg):
|
||||
def _filter(_key, value):
|
||||
|
Loading…
x
Reference in New Issue
Block a user