def putPartition(self, exchangeDesc, compress):
        number = exchangeDesc.number
        cfg = exchangeDesc.config
        loc = exchangeDesc.exchangeloc
        if cfg['storage'] == 'block':
            support.dd(count=cfg['size'], seek=cfg['start'], infile=loc, \
                       outfile=self.node, bs=512)
            #TODO - Do you need to restore the disk label byte for a block put
        if cfg['storage'] == 'tarball':
            #TODO - Migrage the partition creation code here
            #support.createFS()
            self.mountDir = os.path.join(self.exchangeDir, \
                                         "mount" + str(number))
            os.mkdir(self.mountDir)
            support.mount(device=self.node + str(number), dest=self.mountDir)

            #Extract the exchange file to the new partition
            efd = open(loc, 'r')
            #tarp = support.tarExtract_Process(self.mountDir)
            #subprocess.call(compress.getDecompressOpts(),
            #                stdin=efd, stdout=tarp.stdin)
            q = subprocess.Popen(compress.getDecompressOpts(),
                                 stdin=efd,
                                 stdout=subprocess.PIPE)
            p = support.tarExtract_Process(self.mountDir, stdin=q.stdout)
            p.wait()
            q.wait()
            efd.close()
            #support.tar(tarfile=loc, target='', options='xzf', \
            #            cwd=self.mountDir)

            support.umount(self.mountDir)
            support.writePartID(self.node, number, int(cfg['label']))
 def putMBR(self, mbrloc, codeonly=False):
     #if we've rewritten the partition table, we only want to copy in the
     #bootstrap code from the original MBR, which is on bytes [0, 444]
     if codeonly:
         support.dd(count=1, infile=mbrloc, outfile=self.node, bs=445)
     else:
         support.dd(count=1, infile=mbrloc, outfile=self.node, bs=512)
 def getMBR(self):
     self.exchangeMBR = os.path.join(self.exchangeDir, "MBR")
     support.dd(count=1, infile=self.dev.path, \
                bs=512, outfile=self.exchangeMBR)
     return self.exchangeMBR