Repository URL to install this package:
Version:
3.4.46 ▾
|
ó ±EYc @ s0 d Z d d l m Z d e f d YZ d S( sl Main abstraction layer for retrieving and storing information about disk images used by the compute layer. iÿÿÿÿ( t glancet APIc B sk e Z d Z d Z d Z d Z e e d Z d d Z d e d Z d Z d d d Z RS( sæ Responsible for exposing a relatively stable internal API for other modules in Nova to retrieve information about disk images. This API attempts to match the nova.volume.api and nova.network.api calling interface. c C s t j | | S( s[ Returns a tuple of (session, image_id). If the supplied `id_or_uri` is an image ID, then the default client session will be returned for the context's user, along with the image ID. If the supplied `id_or_uri` parameter is a URI, then a client session connecting to the URI's image service endpoint will be returned along with a parsed image ID from that URI. :param context: The `nova.context.Context` object for the request :param id_or_uri: A UUID identifier or an image URI to look up image information for. ( R t get_remote_image_service( t selft contextt id_or_uri( ( sC /home/tvault/.virtenv/lib/python2.7/site-packages/nova/image/api.pyt _get_session_and_image_id s c C s t j S( s¦ Returns a client session that can be used to query for image information. :param _context: The `nova.context.Context` object for the request ( R t get_default_image_service( R t _context( ( sC /home/tvault/.virtenv/lib/python2.7/site-packages/nova/image/api.pyt _get_session+ s c K s | j | } | j | | S( sW Retrieves all information records about all disk images available to show to the requesting user. If the requesting user is an admin, all images in an ACTIVE status are returned. If the requesting user is not an admin, the all public images and all private images that are owned by the requesting user in the ACTIVE status are returned. :param context: The `nova.context.Context` object for the request :param kwargs: A dictionary of filter and pagination values that may be passed to the underlying image info driver. ( R t detail( R R t kwargst session( ( sC /home/tvault/.virtenv/lib/python2.7/site-packages/nova/image/api.pyt get_all8 s c C s4 | j | | \ } } | j | | d | d | S( sN Retrieves the information record for a single disk image. If the supplied identifier parameter is a UUID, the default driver will be used to return information about the image. If the supplied identifier is a URI, then the driver that matches that URI endpoint will be used to query for image information. :param context: The `nova.context.Context` object for the request :param id_or_uri: A UUID identifier or an image URI to look up image information for. :param include_locations: (Optional) include locations in the returned dict of information if the image service API supports it. If the image service API does not support the locations attribute, it will still be included in the returned dict, as an empty list. :param show_deleted: (Optional) show the image even the status of image is deleted. t include_locationst show_deleted( R t show( R R R R R R t image_id( ( sC /home/tvault/.virtenv/lib/python2.7/site-packages/nova/image/api.pyt getF s c C s% | j | } | j | | d | S( s¨ Creates a new image record, optionally passing the image bits to backend storage. :param context: The `nova.context.Context` object for the request :param image_info: A dict of information about the image that is passed to the image registry. :param data: Optional file handle or bytestream iterator that is passed to backend storage. t data( R t create( R R t image_infoR R ( ( sC /home/tvault/.virtenv/lib/python2.7/site-packages/nova/image/api.pyR _ s c C s7 | j | | \ } } | j | | | d | d | S( s Update the information about an image, optionally along with a file handle or bytestream iterator for image bits. If the optional file handle for updated image bits is supplied, the image may not have already uploaded bits for the image. :param context: The `nova.context.Context` object for the request :param id_or_uri: A UUID identifier or an image URI to look up image information for. :param image_info: A dict of information about the image that is passed to the image registry. :param data: Optional file handle or bytestream iterator that is passed to backend storage. :param purge_props: Optional, defaults to False. If set, the backend image registry will clear all image properties and replace them the image properties supplied in the image_info dictionary's 'properties' collection. R t purge_props( R t update( R R R R R R R R ( ( sC /home/tvault/.virtenv/lib/python2.7/site-packages/nova/image/api.pyR l s c C s( | j | | \ } } | j | | S( s Delete the information about an image and mark the image bits for deletion. :param context: The `nova.context.Context` object for the request :param id_or_uri: A UUID identifier or an image URI to look up image information for. ( R t delete( R R R R R ( ( sC /home/tvault/.virtenv/lib/python2.7/site-packages/nova/image/api.pyR s c C s4 | j | | \ } } | j | | d | d | S( s Transfer image bits from Glance or a known source location to the supplied destination filepath. :param context: The `nova.context.RequestContext` object for the request :param id_or_uri: A UUID identifier or an image URI to look up image information for. :param data: A file object to use in downloading image data. :param dest_path: Filepath to transfer image bits to. Note that because of the poor design of the `glance.ImageService.download` method, the function returns different things depending on what arguments are passed to it. If a data argument is supplied but no dest_path is specified (only done in the XenAPI virt driver's image.utils module) then None is returned from the method. If the data argument is not specified but a destination path *is* specified, then a writeable file handle to the destination path is constructed in the method and the image bits written to that file, and again, None is returned from the method. If no data argument is supplied and no dest_path argument is supplied (VMWare and XenAPI virt drivers), then the method returns an iterator to the image bits that the caller uses to write to wherever location it wants. Finally, if the allow_direct_url_schemes CONF option is set to something, then the nova.image.download modules are used to attempt to do an SCP copy of the image bits from a file location to the dest_path and None is returned after retrying one or more download locations (libvirt and Hyper-V virt drivers through nova.virt.images.fetch). I think the above points to just how hacky/wacky all of this code is, and the reason it needs to be cleaned up and standardized across the virt driver callers. R t dst_path( R t download( R R R R t dest_pathR R ( ( sC /home/tvault/.virtenv/lib/python2.7/site-packages/nova/image/api.pyR s %N( t __name__t __module__t __doc__R R R t Falset TrueR t NoneR R R R ( ( ( sC /home/tvault/.virtenv/lib/python2.7/site-packages/nova/image/api.pyR s N( R t nova.imageR t objectR ( ( ( sC /home/tvault/.virtenv/lib/python2.7/site-packages/nova/image/api.pyt <module> s