Revision 3fc0273f snf-tools/synnefo_tools/burnin.py

b/snf-tools/synnefo_tools/burnin.py
49 49
import sys
50 50
import time
51 51
import tempfile
52
import guestfs
53 52
from base64 import b64encode
54 53
from IPy import IP
55 54
from multiprocessing import Process, Queue
......
279 278
        with open(temp_file, "wb+") as f:
280 279
            pithos_client.download_object(image_location[3], f)
281 280

  
282
        log.info("Mount downloaded image and inject personality file")
283
        # XXX: The image is shrinked to the size of the
284
        #      underlying device. To avoid increasing it's size
285
        #      delete the `.aptitude' directory.
286
        g = guestfs.GuestFS()
287
        g.add_drive_opts(temp_file, format="raw", readonly=0)
288
        g.launch()
289
        partitions = g.list_partitions()
290
        g.mount(partitions[0], "/")
291
        g.rm_rf("/root/.aptitude")
292
        g.write("/root/temp.txt", "This is a personality file.")
293
        g.umount_all()
294
        g.close()
295

  
296 281
    def test_007_upload_image(self):
297 282
        """Upload and register image"""
298 283
        temp_file = os.path.join(self.temp_dir, self.temp_image_name)

Also available in: Unified diff