Clean lvm metadata after creating partitions

Run erase_lvm_metadata() after we create all the needed partitions
to make sure we don't have any old LVM data.

We also need to clean old filesystem from newly created partition,
that may retain after previous deployments.

Change-Id: I6ee241aca94a4db7bae2b359af7244dee6a53150
Closes-bug: #1323707
(cherry picked from commit fc6b47a89f)
This commit is contained in:
Aleksandr Didenko 2014-05-27 18:05:44 +03:00 committed by Vladimir Kuklin
parent 7a0bc0c733
commit 6f23c98e70
1 changed files with 8 additions and 1 deletions

View File

@ -834,6 +834,12 @@ class PreseedPManager(object):
self.late("parted -s {0} print free".format(self._disk_dev(disk)))
self.late("find /dev \( -type l -o -type b \) -exec ls -l {} \;")
# clear any fs info that may remain on newly created partition
self.late("dd if=/dev/zero of={0}{1}{2} bs=1M count=10"
"".format(self._disk_dev(disk),
self._pseparator(disk["id"]),
pcount))
if part.get("file_system", "xfs") not in ("swap", None, "none"):
disk_label = self._getlabel(part.get("disk_label"))
self.late("mkfs.{0} {1} {2}{3}{4} {5}"
@ -986,8 +992,9 @@ class PreseedPManager(object):
self.erase_partition_table()
self.boot()
self.os()
self.lv()
self.partitions()
self.erase_lvm_metadata()
self.lv()
self.late("apt-get install -y grub-pc", True)
self.late("sed -i "
"-e 's/.*GRUB_TERMINAL.*/GRUB_TERMINAL=console/g' "