[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v1 02/17] tests/vm: avoid image presence check and r
From: |
Alex Bennée |
Subject: |
[Qemu-devel] [PATCH v1 02/17] tests/vm: avoid image presence check and removal |
Date: |
Wed, 19 Jun 2019 20:40:06 +0100 |
From: Cleber Rosa <address@hidden>
Python's os.rename() will silently replace an existing file,
so there's no need for the extra check and removal.
Reference: https://docs.python.org/3/library/os.html#os.rename
Signed-off-by: Cleber Rosa <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Alex Bennée <address@hidden>
---
tests/vm/centos | 2 --
tests/vm/freebsd | 2 --
tests/vm/netbsd | 2 --
tests/vm/openbsd | 2 --
tests/vm/ubuntu.i386 | 2 --
5 files changed, 10 deletions(-)
diff --git a/tests/vm/centos b/tests/vm/centos
index b00b46a8dc..53976f1c4c 100755
--- a/tests/vm/centos
+++ b/tests/vm/centos
@@ -77,8 +77,6 @@ class CentosVM(basevm.BaseVM):
self.ssh_root_check("systemctl enable docker")
self.ssh_root("poweroff")
self.wait()
- if os.path.exists(img):
- os.remove(img)
os.rename(img_tmp, img)
return 0
diff --git a/tests/vm/freebsd b/tests/vm/freebsd
index 5575c23a6f..091be1a065 100755
--- a/tests/vm/freebsd
+++ b/tests/vm/freebsd
@@ -36,8 +36,6 @@ class FreeBSDVM(basevm.BaseVM):
sys.stderr.write("Extracting the image...\n")
subprocess.check_call(["ln", "-f", cimg, img_tmp_xz])
subprocess.check_call(["xz", "--keep", "-dvf", img_tmp_xz])
- if os.path.exists(img):
- os.remove(img)
os.rename(img_tmp, img)
if __name__ == "__main__":
diff --git a/tests/vm/netbsd b/tests/vm/netbsd
index d0508f4465..ee9eaeab50 100755
--- a/tests/vm/netbsd
+++ b/tests/vm/netbsd
@@ -36,8 +36,6 @@ class NetBSDVM(basevm.BaseVM):
sys.stderr.write("Extracting the image...\n")
subprocess.check_call(["ln", "-f", cimg, img_tmp_xz])
subprocess.check_call(["xz", "--keep", "-dvf", img_tmp_xz])
- if os.path.exists(img):
- os.remove(img)
os.rename(img_tmp, img)
if __name__ == "__main__":
diff --git a/tests/vm/openbsd b/tests/vm/openbsd
index 87ec982489..28c7d25e29 100755
--- a/tests/vm/openbsd
+++ b/tests/vm/openbsd
@@ -38,8 +38,6 @@ class OpenBSDVM(basevm.BaseVM):
sys.stderr.write("Extracting the image...\n")
subprocess.check_call(["ln", "-f", cimg, img_tmp_xz])
subprocess.check_call(["xz", "--keep", "-dvf", img_tmp_xz])
- if os.path.exists(img):
- os.remove(img)
os.rename(img_tmp, img)
if __name__ == "__main__":
diff --git a/tests/vm/ubuntu.i386 b/tests/vm/ubuntu.i386
index a22d137e76..12867b193f 100755
--- a/tests/vm/ubuntu.i386
+++ b/tests/vm/ubuntu.i386
@@ -80,8 +80,6 @@ class UbuntuX86VM(basevm.BaseVM):
self.ssh_root_check("apt-get install -y libfdt-dev flex bison")
self.ssh_root("poweroff")
self.wait()
- if os.path.exists(img):
- os.remove(img)
os.rename(img_tmp, img)
return 0
--
2.20.1
- [Qemu-devel] [PATCH v1 00/17] testing/next (Travis fixes, more tests/vm), Alex Bennée, 2019/06/19
- [Qemu-devel] [PATCH v1 01/17] tests/vm: avoid extra compressed image copy, Alex Bennée, 2019/06/19
- [Qemu-devel] [PATCH v1 04/17] tests/vm: add source repos on ubuntu.i386, Alex Bennée, 2019/06/19
- [Qemu-devel] [PATCH v1 02/17] tests/vm: avoid image presence check and removal,
Alex Bennée <=
- [Qemu-devel] [PATCH v1 03/17] tests/vm: pin ubuntu.i386 image, Alex Bennée, 2019/06/19
- [Qemu-devel] [PATCH v1 08/17] tests/vm: proper guest shutdown, Alex Bennée, 2019/06/19
- [Qemu-devel] [PATCH v1 10/17] tests/vm: serial console support helpers, Alex Bennée, 2019/06/19
- [Qemu-devel] [PATCH v1 14/17] tests/vm: fedora autoinstall, using serial console, Alex Bennée, 2019/06/19
- [Qemu-devel] [PATCH v1 07/17] tests/vm: run test builds on snapshot, Alex Bennée, 2019/06/19
- [Qemu-devel] [PATCH v1 06/17] tests/vm: use ssh with pty unconditionally, Alex Bennée, 2019/06/19