def createPartitions(self):
      """ creates new partition table """
      if not self.exists():
         raise ComException("Device %s not found" % self.getDeviceName())
      import ComParted

      phelper=ComParted.getInstance()
      phelper.createPartitions(self.getDeviceName(), self.getAllPartitions(), self.sameSize())
      self.stabilize()
   def initFromDisk(self):
      """ reads partition information from the disk and fills up DOM
      with new information
      """
      HostDisk.log.debug("initFromDisk()")

      #FIXME: create LabelResolver
      if self.refByLabel():
         pass
      if not self.exists():
         raise ComException("Device %s not found or no valid device!" % self.getDeviceName())
      import ComParted

      phelper=ComParted.getInstance()
      for partition in phelper.initFromDisk(self.getDeviceName()):
         self.addPartition(Partition(partition, self.getDocument()))
    def __create_element_from_parted(self, part, doc):
        import ComParted

        element = doc.createElement(self.TAGNAME)
        phelper = ComParted.getInstance()
        # name
        element.setAttribute("name", str(phelper.getPartNumber(part)))
        # type
        element.setAttribute("type", self.__name_of_part_type(phelper.getPartType(part)))
        # size
        element.setAttribute("size", str(phelper.getPartSize(part)))
        # start
        # element.setAttribute("start", str(part.geom.start))
        # end
        # element.setAttribute("end", str(part.geom.end))
        # all flags
        for flag in phelper.get_flags_as_string(part):
            if flag and flag != "":
                felem = PartitionFlag(doc.createElement("flag"), doc)
                felem.setAttribute("name", flag)
                element.appendChild(felem.getElement())
        return element