~ubuntu-branches/ubuntu/precise/virtinst/precise-updates

« back to all changes in this revision

Viewing changes to virtinst/DistroInstaller.py

  • Committer: Package Import Robot
  • Author(s): Marc Deslauriers
  • Date: 2012-02-11 11:47:53 UTC
  • mfrom: (1.6.6 sid)
  • Revision ID: package-import@ubuntu.com-20120211114753-sq9f3xayrma8px2h
Tags: 0.600.1-1ubuntu1
* Merge from debian unstable. Remaining changes:
  - debian/patches/9003-fix-path-to-hvmloader-in-testsuite.patch: adjust
    testsuite for 0001-fix-path-to-hvmloader.patch and
    0002-Fix-path-to-pygrub.patch.
  - debian/patches/9004_ubuntu_fix_tree_support.patch: Fix tree detection
    for all ISO/HTTP source, to not longer fail with cobbler/koan.
  - debian/patches/9005_ubuntu_precise.patch: Add Ubuntu precise as a
    supported distro.
  - debian/{control,rules,pyversions}: Build using dh_python2, use
    debhelper v8 instead of cdbs; for some reason the package build an
    empty binary package when using dh_python2.
  - debian/control: added acl package to depends.
  - debian/control: added libvirt-bin to recommends

Show diffs side-by-side

added added

removed removed

Lines of Context:
69
69
def _build_pool(conn, meter, path):
70
70
    pool = _util.lookup_pool_by_path(conn, path)
71
71
    if pool:
72
 
        logging.debug("Existing pool '%s' found for %s" % (pool.name(), path))
 
72
        logging.debug("Existing pool '%s' found for %s", pool.name(), path)
73
73
        pool.refresh(0)
74
74
        return pool
75
75
 
76
76
    name = _util.generate_name("boot-scratch",
77
77
                               conn.storagePoolLookupByName)
78
 
    logging.debug("Building storage pool: path=%s name=%s" % (path, name))
 
78
    logging.debug("Building storage pool: path=%s name=%s", path, name)
79
79
    poolbuild = Storage.DirectoryPool(conn=conn, name=name,
80
80
                                      target_path=path)
81
81
 
102
102
    name = Storage.StorageVolume.find_free_name(basename,
103
103
                                                pool_object=destpool)
104
104
    if name != basename:
105
 
        logging.debug("Generated non-colliding volume name %s" % name)
 
105
        logging.debug("Generated non-colliding volume name %s", name)
106
106
 
107
107
    disk = VirtualDisk(conn=conn,
108
108
                       path=os.path.join(poolpath, name),
111
111
 
112
112
    disk.setup_dev(meter=meter)
113
113
    vol = disk.vol_object
 
114
    if not vol:
 
115
        raise RuntimeError(_("Failed to lookup scratch media volume"))
114
116
 
115
117
    try:
116
118
        # Register upload
205
207
        elif os.path.exists(os.path.abspath(val)) and is_local:
206
208
            val = os.path.abspath(val)
207
209
            logging.debug("DistroInstaller location is a local "
208
 
                          "file/path: %s" % val)
 
210
                          "file/path: %s", val)
209
211
 
210
212
        else:
211
213
            # Didn't determine anything about the location
229
231
                                conn=self.conn,
230
232
                                volName=stuple)
231
233
                val = d.path
232
 
            except Exception, e:
233
 
                logging.debug(str(e))
 
234
            except:
 
235
                logging.debug("Error validating install location",
 
236
                              exc_info=True)
234
237
                raise ValueError(_("Checking installer location failed: "
235
238
                                   "Could not find media '%s'." % str(val)))
236
239
        elif not validated:
270
273
                           transient=transient)
271
274
        self.install_devices.append(disk)
272
275
 
273
 
    def _perform_initrd_injections(self):
 
276
    def _perform_initrd_injections(self, initrd):
274
277
        """
275
278
        Insert files into the root directory of the initial ram disk
276
279
        """
277
 
        initrd = self._install_bootconfig.initrd
278
280
        tempdir = tempfile.mkdtemp(dir=self.scratchdir)
279
281
        os.chmod(tempdir, 0775)
280
282
 
281
283
        for filename in self._initrd_injections:
282
 
            logging.debug("Copying %s to the initrd." % filename)
 
284
            logging.debug("Copying %s to the initrd.", filename)
283
285
            shutil.copy(filename, tempdir)
284
286
 
285
287
        logging.debug("Appending to the initrd.")
302
304
    def support_remote_url_install(self):
303
305
        if not self.conn:
304
306
            return False
 
307
        if hasattr(self.conn, "_virtinst__fake_conn"):
 
308
            return False
305
309
        return support.check_stream_support(self.conn,
306
310
                                            support.SUPPORT_STREAM_UPLOAD)
307
311
 
310
314
        system_scratchdir = self._get_system_scratchdir()
311
315
 
312
316
        if (not guest.is_remote() and
313
 
            self.scratchdir == system_scratchdir):
 
317
            (self.is_session_uri() or self.scratchdir == system_scratchdir)):
314
318
            # We have access to system scratchdir, don't jump through hoops
315
 
            logging.debug("Have access to local system scratchdir so"
 
319
            logging.debug("Have access to preferred scratchdir so"
316
320
                          " nothing to upload")
317
321
            return kernel, initrd
318
322
 
367
371
 
368
372
        if guest.get_os_autodetect():
369
373
            if os_type:
370
 
                logging.debug("Auto detected OS type as: %s" % os_type)
 
374
                logging.debug("Auto detected OS type as: %s", os_type)
371
375
                guest.os_type = os_type
372
376
 
373
377
            if (os_variant and guest.os_type == os_type):
374
 
                logging.debug("Auto detected OS variant as: %s" % os_variant)
 
378
                logging.debug("Auto detected OS variant as: %s", os_variant)
375
379
                guest.os_variant = os_variant
376
380
 
377
381
        self._tmpfiles.append(kernelfn)
379
383
            self._tmpfiles.append(initrdfn)
380
384
 
381
385
        if self._initrd_injections:
382
 
            self._perform_initrd_injections()
 
386
            self._perform_initrd_injections(initrdfn)
383
387
 
384
388
        # If required, upload media to an accessible guest location
385
389
        kernelfn, initrdfn = self._upload_media(guest, meter,