<commit_before>--- a/pmanager.py	2015-03-13 16:14:43.955031037 +0300
+++ b/pmanager.py	2015-03-13 18:57:27.173407487 +0300
@@ -672,8 +672,26 @@
     def num_ceph_osds(self):
         return self.get_partition_count('ceph')
 
+    def contains_save_ceph(self, disk=None, part=None):
+        def is_save_partition(part):
+            return (part.get("name") == "ceph" and
+                        part["type"] == "partition" and
+                        part["size"] > 0 and
+                        part.get("keep"))
+        if disk is not None:
+            for volume in disk["volumes"]:
+                if is_save_partition(volume):
+                    return True
+            return False
+        elif part is not None:
+            return is_save_partition(part)
+
     def erase_partition_table(self):
         for disk in self.iterdisks():
+            if self.contains_save_ceph(disk=disk):
+                self.early("parted -s {0} print free"
+                           .format(self._disk_dev(disk)))
+                continue
             self.early("test -e {0} && "
                        "dd if=/dev/zero of={0} "
                        "bs=1M count=10".format(self._disk_dev(disk)))
@@ -861,6 +879,9 @@
                 self.late("cat /proc/mdstat")
                 self.late("cat /proc/partitions")
 
+                if self.contains_save_ceph(part=part):
+                    continue
+
                 # 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),<commit_msg>Fix patch for Cobbler pmanager.py module for 6.1<commit_after>diff --git a/pmanager.py b/pmanager.py
index 2c081d8..78013df 100644
--- a/pmanager.py
+++ b/pmanager.py
@@ -696,8 +696,26 @@ class PreseedPManager(object):
     def num_ceph_osds(self):
         return self.get_partition_count('ceph')
 
+    def contains_save_ceph(self, disk=None, part=None):
+        def is_save_partition(part):
+            return (part.get("name") == "ceph" and
+                        part["type"] == "partition" and
+                        part["size"] > 0 and
+                        part.get("keep"))
+        if disk is not None:
+            for volume in disk["volumes"]:
+                if is_save_partition(volume):
+                    return True
+            return False
+        elif part is not None:
+            return is_save_partition(part)
+
     def erase_partition_table(self):
         for disk in self.iterdisks():
+            if self.contains_save_ceph(disk=disk):
+                self.early("parted -s {0} print free"
+                           .format(self._disk_dev(disk)))
+                continue
             self.early("test -e {0} && "
                        "dd if=/dev/zero of={0} "
                        "bs=1M count=10".format(self._disk_dev(disk)))
@@ -913,6 +931,9 @@ class PreseedPManager(object):
                 self.late("cat /proc/mdstat")
                 self.late("cat /proc/partitions")
 
+                if self.contains_save_ceph(part=part):
+                    continue
+
                 # 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),
{'fraction_non_alphanumeric': 0.13107947805456702, 'fraction_numerical': 0.03914590747330961, 'mean_word_length': 1.6127033307513556, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3503217', 'n_tokens_mistral': 1111, 'n_tokens_neox': 1001, 'n_words': 216}