~sandy-walsh/nova/zones

« back to all changes in this revision

Viewing changes to nova/virt/xenapi/vm_utils.py

  • Committer: Sandy Walsh
  • Date: 2011-02-17 21:39:03 UTC
  • mfrom: (635.1.60 nova)
  • Revision ID: sandy.walsh@rackspace.com-20110217213903-swehe88wea8inxow
changed from 003-004 migration

Show diffs side-by-side

added added

removed removed

Lines of Context:
139
139
        return vm_ref
140
140
 
141
141
    @classmethod
 
142
    def ensure_free_mem(cls, session, instance):
 
143
        instance_type = instance_types.INSTANCE_TYPES[instance.instance_type]
 
144
        mem = long(instance_type['memory_mb']) * 1024 * 1024
 
145
        #get free memory from host
 
146
        host = session.get_xenapi_host()
 
147
        host_free_mem = long(session.get_xenapi().host.
 
148
                             compute_free_memory(host))
 
149
        return host_free_mem >= mem
 
150
 
 
151
    @classmethod
142
152
    def create_vbd(cls, session, vm_ref, vdi_ref, userdevice, bootable):
143
153
        """Create a VBD record.  Returns a Deferred that gives the new
144
154
        VBD reference."""
384
394
            pv = True
385
395
        elif pv_str.lower() == 'false':
386
396
            pv = False
387
 
        LOG.debug(_("PV Kernel in VDI:%d"), pv)
 
397
        LOG.debug(_("PV Kernel in VDI:%s"), pv)
388
398
        return pv
389
399
 
390
400
    @classmethod