[RHEL 7.2 - PATCH 1/5] Fix obsolete format size constraints (#1178884)
by Robert Marshall
From: David Lehman <dlehman(a)redhat.com>
The format type may impose limits on the device size. Unset the format
type prior to setting the device size and avoid constraints that may
change when the format is set later.
Cherry pick taken from master commit a5000d4.
Resolves: rhbz:#1178884
---
blivet/devicefactory.py | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/blivet/devicefactory.py b/blivet/devicefactory.py
index fb8ee27..0a86c90 100644
--- a/blivet/devicefactory.py
+++ b/blivet/devicefactory.py
@@ -643,6 +643,10 @@ class DeviceFactory(object):
pass
def _set_size(self):
+ # reset the device's format before allocating partitions, &c
+ if self.device.format.type != self.fstype:
+ self.device.format = None
+
# this is setting the device size based on the factory size and the
# current size of the container
self._set_device_size()
--
1.8.3.1
8 years, 10 months
[PATCH] Clean up the temporary pools virt-install makes.
by Chris Lumens
For a directory path like /var/tmp/kstest-whatever/disks, virt-install is
making two storage pools: kstest-whatever, and disks-XX. It also doesn't
get rid of these pools after it shuts down, and you will eventually end up
with a giant pile of them clogging everything up.
So there are two fixes here to do the clean up:
(1) We know the name of the first pool associated with a single test. It's
the temporary directory being created in /var/tmp. So just use the virsh
commands to destroy that pool.
(2) We don't know (and can't figure out) the name of the disks-XX pool.
However, that one is only being created because of the subdirectory that disk
images are being stored in. So instead store them in /var/tmp/kstest-whatever
and do not create the disks subdirectory any more.
---
tests/kickstart_tests/basic-ostree.sh | 4 ++--
tests/kickstart_tests/btrfs-1.sh | 2 +-
tests/kickstart_tests/btrfs-2.sh | 2 +-
tests/kickstart_tests/driverdisk-disk.sh | 6 +++---
tests/kickstart_tests/encrypt-device.sh | 2 +-
tests/kickstart_tests/functions.sh | 6 +++---
tests/kickstart_tests/hostname.sh | 2 +-
tests/kickstart_tests/kstest-runner | 6 ++++--
tests/kickstart_tests/raid-1.sh | 8 ++++----
tests/kickstart_tests/run_one_ks.sh | 9 ++-------
tests/kickstart_tests/tmpfs-fixed_size.sh | 2 +-
11 files changed, 23 insertions(+), 26 deletions(-)
diff --git a/tests/kickstart_tests/basic-ostree.sh b/tests/kickstart_tests/basic-ostree.sh
index 4329410..215d3e3 100755
--- a/tests/kickstart_tests/basic-ostree.sh
+++ b/tests/kickstart_tests/basic-ostree.sh
@@ -35,8 +35,8 @@ prepare() {
validate() {
disksdir=$1
- qemuArgs=$(for d in ${disksdir}/*img; do echo -drive file=${d}; done)
- virtCatArgs=$(for d in ${disksdir}/*img; do echo -a ${d}; done)
+ qemuArgs=$(for d in ${disksdir}/disk-*img; do echo -drive file=${d}; done)
+ virtCatArgs=$(for d in ${disksdir}/disk-*img; do echo -a ${d}; done)
# Now attempt to boot the resulting VM and see if the install
# actually worked. The VM will shut itself down so there's no
diff --git a/tests/kickstart_tests/btrfs-1.sh b/tests/kickstart_tests/btrfs-1.sh
index 9b0c90a..16c00a8 100755
--- a/tests/kickstart_tests/btrfs-1.sh
+++ b/tests/kickstart_tests/btrfs-1.sh
@@ -21,7 +21,7 @@
validate() {
disksdir=$1
- args=$(for d in ${disksdir}/*img; do echo -a ${d}; done)
+ args=$(for d in ${disksdir}/disk-*img; do echo -a ${d}; done)
# There should be a /root/root/RESULT file with results in it. Check
# its contents and decide whether the test finally succeeded or
diff --git a/tests/kickstart_tests/btrfs-2.sh b/tests/kickstart_tests/btrfs-2.sh
index 9b0c90a..16c00a8 100755
--- a/tests/kickstart_tests/btrfs-2.sh
+++ b/tests/kickstart_tests/btrfs-2.sh
@@ -21,7 +21,7 @@
validate() {
disksdir=$1
- args=$(for d in ${disksdir}/*img; do echo -a ${d}; done)
+ args=$(for d in ${disksdir}/disk-*img; do echo -a ${d}; done)
# There should be a /root/root/RESULT file with results in it. Check
# its contents and decide whether the test finally succeeded or
diff --git a/tests/kickstart_tests/driverdisk-disk.sh b/tests/kickstart_tests/driverdisk-disk.sh
index c510742..862fdf1 100755
--- a/tests/kickstart_tests/driverdisk-disk.sh
+++ b/tests/kickstart_tests/driverdisk-disk.sh
@@ -18,10 +18,10 @@
. ${KSTESTDIR}/functions.sh
prepare_disks() {
- local diskdir="$1/disks"
+ local diskdir="$1"
# main disk
- qemu-img create -q -f qcow2 ${diskdir}/a.img 10G
- echo "${diskdir}/a.img"
+ qemu-img create -q -f qcow2 ${diskdir}/disk-a.img 10G
+ echo "${diskdir}/disk-a.img"
# driverdisk image
${KSTESTDIR}/../lib/mkdud.py -k -b -L "TEST_DD" ${diskdir}/dd.iso >/dev/null
diff --git a/tests/kickstart_tests/encrypt-device.sh b/tests/kickstart_tests/encrypt-device.sh
index 918c0ca..a59197e 100755
--- a/tests/kickstart_tests/encrypt-device.sh
+++ b/tests/kickstart_tests/encrypt-device.sh
@@ -21,7 +21,7 @@
validate() {
disksdir=$1
- args=$(for d in ${disksdir}/*img; do echo -a ${d}; done)
+ args=$(for d in ${disksdir}/disk-*img; do echo -a ${d}; done)
# There should be a /home/RESULT (because / is encrypted) file with results
# in it. Check its contents and decide whether the test finally succeeded
diff --git a/tests/kickstart_tests/functions.sh b/tests/kickstart_tests/functions.sh
index 01c2f2b..04422db 100644
--- a/tests/kickstart_tests/functions.sh
+++ b/tests/kickstart_tests/functions.sh
@@ -32,13 +32,13 @@ prepare() {
prepare_disks() {
tmpdir=$1
- qemu-img create -q -f qcow2 ${tmpdir}/disks/a.img 10G
- echo ${tmpdir}/disks/a.img
+ qemu-img create -q -f qcow2 ${tmpdir}/disk-a.img 10G
+ echo ${tmpdir}/disk-a.img
}
validate() {
disksdir=$1
- args=$(for d in ${disksdir}/*img; do echo -a ${d}; done)
+ args=$(for d in ${disksdir}/disk-*img; do echo -a ${d}; done)
# There should be a /root/RESULT file with results in it. Check
# its contents and decide whether the test finally succeeded or
diff --git a/tests/kickstart_tests/hostname.sh b/tests/kickstart_tests/hostname.sh
index 5aa73e5..050423c 100755
--- a/tests/kickstart_tests/hostname.sh
+++ b/tests/kickstart_tests/hostname.sh
@@ -21,7 +21,7 @@
validate() {
disksdir=$1
- args=$(for d in ${disksdir}/*img; do echo -a ${d}; done)
+ args=$(for d in ${disksdir}/disk-*img; do echo -a ${d}; done)
# There should be a /root/RESULT file with results in it. Check
# its contents and decide whether the test finally succeeded or
diff --git a/tests/kickstart_tests/kstest-runner b/tests/kickstart_tests/kstest-runner
index d6ff678..7b8d3ba 100755
--- a/tests/kickstart_tests/kstest-runner
+++ b/tests/kickstart_tests/kstest-runner
@@ -136,7 +136,7 @@ class VirtualInstall(object):
else:
log.info("Install finished. Or at least virt shut down.")
- def destroy(self):
+ def destroy(self, poolName):
"""
Make sure the virt has been shut down and destroyed
@@ -145,6 +145,8 @@ class VirtualInstall(object):
log.info("Shutting down %s", self.virt_name)
subprocess.call(["virsh", "destroy", self.virt_name])
subprocess.call(["virsh", "undefine", self.virt_name])
+ subprocess.call(["virsh", "pool-destroy", poolName])
+ subprocess.call(["virsh", "pool-undefine", poolName])
def virt_install(opts, install_log):
"""
@@ -173,7 +175,7 @@ def virt_install(opts, install_log):
virtio_host = log_monitor.host,
virtio_port = log_monitor.port)
- virt.destroy()
+ virt.destroy(os.path.basename(opts.tmp))
log_monitor.shutdown()
except InstallError as e:
log.error("VirtualInstall failed: %s", e)
diff --git a/tests/kickstart_tests/raid-1.sh b/tests/kickstart_tests/raid-1.sh
index 4ed81ed..fc7fc9b 100755
--- a/tests/kickstart_tests/raid-1.sh
+++ b/tests/kickstart_tests/raid-1.sh
@@ -22,14 +22,14 @@
prepare_disks() {
tmpdir=$1
- qemu-img create -q -f qcow2 ${tmpdir}/disks/a.img 10G
- qemu-img create -q -f qcow2 ${tmpdir}/disks/b.img 10G
- echo ${tmpdir}/disks/a.img ${tmpdir}/disks/b.img
+ qemu-img create -q -f qcow2 ${tmpdir}/disk-a.img 10G
+ qemu-img create -q -f qcow2 ${tmpdir}/disk-b.img 10G
+ echo ${tmpdir}/disk-a.img ${tmpdir}/disk-b.img
}
validate() {
disksdir=$1
- args=$(for d in ${disksdir}/*img; do echo -a ${d}; done)
+ args=$(for d in ${disksdir}/disk-*img; do echo -a ${d}; done)
# virt-cat doesn't setup /dev/md/* links so cross our fingers that
# / always ends up on /dev/md126
diff --git a/tests/kickstart_tests/run_one_ks.sh b/tests/kickstart_tests/run_one_ks.sh
index b5234d9..cf48f4b 100755
--- a/tests/kickstart_tests/run_one_ks.sh
+++ b/tests/kickstart_tests/run_one_ks.sh
@@ -42,7 +42,7 @@ cleanup() {
if [[ ${KEEPIT} == 2 ]]; then
return
elif [[ ${KEEPIT} == 1 ]]; then
- rm -rf ${d}/disks ${d}/*ks
+ rm -f ${d}/disk-*.img ${d}/*ks
elif [[ ${KEEPIT} == 0 ]]; then
rm -rf ${d}
fi
@@ -82,7 +82,6 @@ runone() {
kargs="--kernel-args \"$kargs\""
fi
- mkdir -p ${tmpdir}/disks/
disks=$(prepare_disks ${tmpdir})
disk_args=$(for d in $disks; do echo --disk $d; done)
@@ -105,13 +104,9 @@ runone() {
echo RESULT:${name}:FAILED:Test timed out.
cleanup ${tmpdir}
return 2
- elif [[ ! -d ${tmpdir}/disks ]]; then
- echo RESULT:${name}:FAILED:Disk images do not exist.
- cleanup ${tmpdir}
- return 1
fi
- result=$(validate ${tmpdir}/disks)
+ result=$(validate ${tmpdir})
if [[ $? != 0 ]]; then
echo RESULT:${name}:FAILED:"${result}"
cleanup ${tmpdir}
diff --git a/tests/kickstart_tests/tmpfs-fixed_size.sh b/tests/kickstart_tests/tmpfs-fixed_size.sh
index 3c48321..d8ccfd2 100755
--- a/tests/kickstart_tests/tmpfs-fixed_size.sh
+++ b/tests/kickstart_tests/tmpfs-fixed_size.sh
@@ -21,7 +21,7 @@
validate() {
disksdir=$1
- args=$(for d in ${disksdir}/*img; do echo -a ${d}; done)
+ args=$(for d in ${disksdir}/disk-*img; do echo -a ${d}; done)
# There should be a /root/RESULT file with results in it. Check
# its contents and decide whether the test finally succeeded or
--
2.4.3
8 years, 10 months
[RHEL 7.2 - PATCH 5/5] Apply default partition size earlier (#1178884)
by Robert Marshall
From: David Lehman <dlehman(a)redhat.com>
If no size is passed to the constructor, the size will be 0 when the
format size gets initialized. This proves problematic when the format
has a minimum size set.
Cherry pick taken from commit 76377d9.
Conflicts:
blivet/devices/partition.py
Resolves: rhbz#178884
---
blivet/devices/partition.py | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)
diff --git a/blivet/devices/partition.py b/blivet/devices/partition.py
index 18add66..97e3cca 100644
--- a/blivet/devices/partition.py
+++ b/blivet/devices/partition.py
@@ -131,6 +131,12 @@ class PartitionDevice(StorageDevice):
self._partedPartition = None
self._origPath = None
+ if not exists and size is None:
+ if start is not None and end is not None:
+ size = Size(0)
+ else:
+ size = self.defaultSize
+
StorageDevice.__init__(self, name, fmt=fmt, size=size,
major=major, minor=minor, exists=exists,
sysfsPath=sysfsPath, parents=parents)
@@ -165,13 +171,6 @@ class PartitionDevice(StorageDevice):
# XXX It might be worthwhile to create a shit-simple
# PartitionRequest class and pass one to this constructor
# for new partitions.
- if not self._size:
- if start is not None and end is not None:
- self._size = 0
- else:
- # default size for new partition requests
- self._size = self.defaultSize
-
self.req_name = name
self.req_partType = partType
self.req_primary = primary
--
1.8.3.1
8 years, 10 months
[RHEL 7.2 - PATCH 1/3] Fix obsolete format size constraints (#1178884)
by Robert Marshall
From: David Lehman <dlehman(a)redhat.com>
The format type may impose limits on the device size. Unset the format
type prior to setting the device size and avoid constraints that may
change when the format is set later.
Cherry pick taken from master commit a5000d4.
Resolves: rhbz:#1178884
---
blivet/devicefactory.py | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/blivet/devicefactory.py b/blivet/devicefactory.py
index fb8ee27..0a86c90 100644
--- a/blivet/devicefactory.py
+++ b/blivet/devicefactory.py
@@ -643,6 +643,10 @@ class DeviceFactory(object):
pass
def _set_size(self):
+ # reset the device's format before allocating partitions, &c
+ if self.device.format.type != self.fstype:
+ self.device.format = None
+
# this is setting the device size based on the factory size and the
# current size of the container
self._set_device_size()
--
1.8.3.1
8 years, 10 months