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

« back to all changes in this revision

Viewing changes to nova/virt/fake.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:
29
29
from nova import db
30
30
from nova import exception
31
31
from nova.openstack.common import log as logging
32
 
from nova import utils
33
32
from nova.virt import driver
34
33
 
35
34
 
93
92
        if not instance['name'] in self.instances:
94
93
            raise exception.InstanceNotRunning()
95
94
 
96
 
    def reboot(self, instance, network_info, reboot_type):
 
95
    def reboot(self, instance, network_info, reboot_type,
 
96
               block_device_info=None):
97
97
        pass
98
98
 
99
99
    @staticmethod
106
106
    def inject_file(self, instance, b64_path, b64_contents):
107
107
        pass
108
108
 
109
 
    def resume_state_on_host_boot(self, context, instance, network_info):
 
109
    def resume_state_on_host_boot(self, context, instance, network_info,
 
110
                                  block_device_info=None):
110
111
        pass
111
112
 
112
113
    def rescue(self, context, instance, network_info, image_meta,
220
221
    def refresh_provider_fw_rules(self):
221
222
        pass
222
223
 
223
 
    def update_available_resource(self, ctxt, host):
 
224
    def get_available_resource(self):
224
225
        """Updates compute manager resource info on ComputeNode table.
225
226
 
226
227
           Since we don't have a real hypervisor, pretend we have lots of
227
228
           disk and ram.
228
229
        """
229
230
 
230
 
        try:
231
 
            service_ref = db.service_get_all_compute_by_host(ctxt, host)[0]
232
 
        except exception.NotFound:
233
 
            raise exception.ComputeServiceUnavailable(host=host)
234
 
 
235
 
        # Updating host information
236
231
        dic = {'vcpus': 1,
237
232
               'memory_mb': 4096,
238
233
               'local_gb': 1028,
241
236
               'local_gb_used': 0,
242
237
               'hypervisor_type': 'fake',
243
238
               'hypervisor_version': '1.0',
244
 
                  'service_id': service_ref['id'],
245
 
                 'cpu_info': '?'}
246
 
 
247
 
        compute_node_ref = service_ref['compute_node']
248
 
        if not compute_node_ref:
249
 
            LOG.info(_('Compute_service record created for %s ') % host)
250
 
            db.compute_node_create(ctxt, dic)
251
 
        else:
252
 
            LOG.info(_('Compute_service record updated for %s ') % host)
253
 
            db.compute_node_update(ctxt, compute_node_ref[0]['id'], dic)
 
239
               'cpu_info': '?'}
 
240
        return dic
254
241
 
255
242
    def ensure_filtering_rules_for_instance(self, instance_ref, network_info):
256
243
        """This method is supported only by libvirt."""