~mdragon/nova/system-usages

« back to all changes in this revision

Viewing changes to nova/virt/fake.py

  • Committer: Monsyne Dragon
  • Date: 2011-06-28 10:23:00 UTC
  • mfrom: (1077.1.141 nova)
  • Revision ID: mdragon@rackspace.com-20110628102300-lnkdr13k8uuyp30i
remergedĀ trunkĀ 

Show diffs side-by-side

added added

removed removed

Lines of Context:
82
82
 
83
83
    def __init__(self):
84
84
        self.instances = {}
 
85
        self.host_status = {
 
86
          'host_name-description': 'Fake Host',
 
87
          'host_hostname': 'fake-mini',
 
88
          'host_memory_total': 8000000000,
 
89
          'host_memory_overhead': 10000000,
 
90
          'host_memory_free': 7900000000,
 
91
          'host_memory_free_computed': 7900000000,
 
92
          'host_other_config': {},
 
93
          'host_ip_address': '192.168.1.109',
 
94
          'host_cpu_info': {},
 
95
          'disk_available': 500000000000,
 
96
          'disk_total': 600000000000,
 
97
          'disk_used': 100000000000,
 
98
          'host_uuid': 'cedb9b39-9388-41df-8891-c5c9a0c0fe5f',
 
99
          'host_name_label': 'fake-mini'}
85
100
 
86
101
    @classmethod
87
102
    def instance(cls):
114
129
            info_list.append(self._map_to_instance_info(instance))
115
130
        return info_list
116
131
 
117
 
    def spawn(self, instance):
 
132
    def spawn(self, instance, network_info=None, block_device_mapping=None):
118
133
        """
119
134
        Create a new instance/VM/domain on the virtualization platform.
120
135
 
210
225
        """
211
226
        pass
212
227
 
 
228
    def agent_update(self, instance, url, md5hash):
 
229
        """
 
230
        Update agent on the specified instance.
 
231
 
 
232
        The first parameter is an instance of nova.compute.service.Instance,
 
233
        and so the instance is being specified as instance.name. The second
 
234
        parameter is the URL of the agent to be fetched and updated on the
 
235
        instance; the third is the md5 hash of the file for verification
 
236
        purposes.
 
237
 
 
238
        The work will be done asynchronously.  This function returns a
 
239
        task that allows the caller to detect when it is complete.
 
240
        """
 
241
        pass
 
242
 
213
243
    def rescue(self, instance):
214
244
        """
215
245
        Rescue the specified instance.
222
252
        """
223
253
        pass
224
254
 
 
255
    def poll_rescued_instances(self, timeout):
 
256
        """Poll for rescued instances"""
 
257
        pass
 
258
 
225
259
    def migrate_disk_and_power_off(self, instance, dest):
226
260
        """
227
261
        Transfers the disk of a running instance in multiple phases, turning
432
466
        """
433
467
        return True
434
468
 
 
469
    def refresh_provider_fw_rules(self):
 
470
        """This triggers a firewall update based on database changes.
 
471
 
 
472
        When this is called, rules have either been added or removed from the
 
473
        datastore.  You can retrieve rules with
 
474
        :method:`nova.db.api.provider_fw_rule_get_all`.
 
475
 
 
476
        Provider rules take precedence over security group rules.  If an IP
 
477
        would be allowed by a security group ingress rule, but blocked by
 
478
        a provider rule, then packets from the IP are dropped.  This includes
 
479
        intra-project traffic in the case of the allow_project_net_traffic
 
480
        flag for the libvirt-derived classes.
 
481
 
 
482
        """
 
483
        pass
 
484
 
435
485
    def update_available_resource(self, ctxt, host):
436
486
        """This method is supported only by libvirt."""
437
487
        return
456
506
    def test_remove_vm(self, instance_name):
457
507
        """ Removes the named VM, as if it crashed. For testing"""
458
508
        self.instances.pop(instance_name)
 
509
 
 
510
    def update_host_status(self):
 
511
        """Return fake Host Status of ram, disk, network."""
 
512
        return self.host_status
 
513
 
 
514
    def get_host_stats(self, refresh=False):
 
515
        """Return fake Host Status of ram, disk, network."""
 
516
        return self.host_status