~raxnetworking/nova/bare_bones_melange

« back to all changes in this revision

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

  • Committer: Rajaram Mallya
  • Date: 2011-09-14 11:46:48 UTC
  • mfrom: (1265.2.302 nova)
  • Revision ID: rajarammallya@gmail.com-20110914114648-a12n6zr1uctd3wxu
Merged from nova trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
31
31
import uuid
32
32
from xml.dom import minidom
33
33
 
34
 
import glance.client
35
34
from nova import db
36
35
from nova import exception
37
36
from nova import flags
38
 
import nova.image
39
 
from nova.image import glance as glance_image_service
 
37
from nova.image import glance
40
38
from nova import log as logging
41
39
from nova import utils
42
40
from nova.compute import instance_types
383
381
 
384
382
        os_type = instance.os_type or FLAGS.default_os_type
385
383
 
386
 
        glance_host, glance_port = \
387
 
            glance_image_service.pick_glance_api_server()
 
384
        glance_host, glance_port = glance.pick_glance_api_server()
388
385
        params = {'vdi_uuids': vdi_uuids,
389
386
                  'image_id': image_id,
390
387
                  'glance_host': glance_host,
447
444
        # pass them as arguments
448
445
        uuid_stack = [str(uuid.uuid4()) for i in xrange(2)]
449
446
 
450
 
        glance_host, glance_port = \
451
 
            glance_image_service.pick_glance_api_server()
 
447
        glance_host, glance_port = glance.pick_glance_api_server()
452
448
        params = {'image_id': image,
453
449
                  'glance_host': glance_host,
454
450
                  'glance_port': glance_port,
546
542
        else:
547
543
            sr_ref = safe_find_sr(session)
548
544
 
549
 
        glance_client, image_id = nova.image.get_glance_client(image)
 
545
        glance_client, image_id = glance.get_glance_client(context, image)
550
546
        glance_client.set_auth_token(getattr(context, 'auth_token', None))
551
547
        meta, image_file = glance_client.get_image(image_id)
552
548
        virtual_size = int(meta['size'])
606
602
            raise e
607
603
 
608
604
    @classmethod
609
 
    def determine_disk_image_type(cls, instance):
 
605
    def determine_disk_image_type(cls, instance, context):
610
606
        """Disk Image Types are used to determine where the kernel will reside
611
607
        within an image. To figure out which type we're dealing with, we use
612
608
        the following rules:
639
635
                'vhd': ImageType.DISK_VHD,
640
636
                'iso': ImageType.DISK_ISO}
641
637
            image_ref = instance.image_ref
642
 
            glance_client, image_id = nova.image.get_glance_client(image_ref)
 
638
            glance_client, image_id = glance.get_glance_client(context,
 
639
                                                               image_ref)
643
640
            meta = glance_client.get_image_meta(image_id)
644
641
            disk_format = meta['disk_format']
645
642
            try: