~ubuntu-branches/ubuntu/quantal/nova/quantal-proposed

« back to all changes in this revision

Viewing changes to nova/virt/baremetal/driver.py

  • Committer: Package Import Robot
  • Author(s): Adam Gandelman, Adam Gandelman, Chuck Short
  • Date: 2012-08-27 15:37:18 UTC
  • mfrom: (1.1.60)
  • Revision ID: package-import@ubuntu.com-20120827153718-lj8er44eqqz1gsrj
Tags: 2012.2~rc1~20120827.15815-0ubuntu1
[ Adam Gandelman ]
* New upstream release.

[ Chuck Short ]
* debian/patches/0001-Update-tools-hacking-for-pep8-1.2-and-
  beyond.patch: Dropped we dont run pep8 tests anymore.
* debian/control: Drop pep8 build depends
* debian/*.upstart.in: Make sure we transition correctly from runlevel
  1 to 2. (LP: #820694)

Show diffs side-by-side

added added

removed removed

Lines of Context:
303
303
        if not os.path.exists(target):
304
304
            base_dir = os.path.join(FLAGS.instances_path, '_base')
305
305
            if not os.path.exists(base_dir):
306
 
                libvirt_utils.ensure_tree(base_dir)
 
306
                utils.ensure_tree(base_dir)
307
307
            base = os.path.join(base_dir, fname)
308
308
 
309
309
            @utils.synchronized(fname)
331
331
                                fname + suffix)
332
332
 
333
333
        # ensure directories exist and are writable
334
 
        libvirt_utils.ensure_tree(basepath(suffix=''))
 
334
        utils.ensure_tree(basepath(suffix=''))
335
335
        utils.execute('chmod', '0777', basepath(suffix=''))
336
336
 
337
337
        LOG.info(_('instance %s: Creating image'), inst['name'],
339
339
 
340
340
        if FLAGS.baremetal_type == 'lxc':
341
341
            container_dir = '%s/rootfs' % basepath(suffix='')
342
 
            libvirt_utils.ensure_tree(container_dir)
 
342
            utils.ensure_tree(container_dir)
343
343
 
344
344
        # NOTE(vish): No need add the suffix to console.log
345
345
        libvirt_utils.write_to_file(basepath('console.log', ''), '', 007)
659
659
        # Bare metal doesn't currently support security groups
660
660
        pass
661
661
 
662
 
    def update_available_resource(self, ctxt, host):
 
662
    def get_available_resource(self):
663
663
        """Updates compute manager resource info on ComputeNode table.
664
664
 
665
665
        This method is called when nova-coompute launches, and
666
666
        whenever admin executes "nova-manage service update_resource".
667
 
 
668
 
        :param ctxt: security context
669
 
        :param host: hostname that compute manager is currently running
670
 
 
671
667
        """
672
668
 
673
 
        try:
674
 
            service_ref = db.service_get_all_compute_by_host(ctxt, host)[0]
675
 
        except exception.NotFound:
676
 
            raise exception.ComputeServiceUnavailable(host=host)
677
 
 
678
669
        # Updating host information
679
670
        dic = {'vcpus': self.get_vcpu_total(),
680
671
               'memory_mb': self.get_memory_mb_total(),
685
676
               'hypervisor_type': self.get_hypervisor_type(),
686
677
               'hypervisor_version': self.get_hypervisor_version(),
687
678
               'cpu_info': self.get_cpu_info(),
688
 
               'cpu_arch': FLAGS.cpu_arch,
689
 
               'service_id': service_ref['id']}
 
679
               'cpu_arch': FLAGS.cpu_arch}
690
680
 
691
 
        compute_node_ref = service_ref['compute_node']
692
681
        LOG.info(_('#### RLK: cpu_arch = %s ') % FLAGS.cpu_arch)
693
 
        if not compute_node_ref:
694
 
            LOG.info(_('Compute_service record created for %s ') % host)
695
 
            dic['service_id'] = service_ref['id']
696
 
            db.compute_node_create(ctxt, dic)
697
 
        else:
698
 
            LOG.info(_('Compute_service record updated for %s ') % host)
699
 
            db.compute_node_update(ctxt, compute_node_ref[0]['id'], dic)
 
682
        return dic
700
683
 
701
684
    def ensure_filtering_rules_for_instance(self, instance_ref, network_info):
702
685
        raise NotImplementedError()