Пример #1
0
 def copy_volume_to_image(self, context, volume, image_service, image_id):
     """Copy the volume to the specified image."""
     volume_path = self.local_path(volume)
     with utils.temporary_chown(volume_path):
         with utils.file_open(volume_path) as volume_file:
             image_service.update(context, image_id, {}, volume_file)
Пример #2
0
 def copy_volume_to_image(self, context, volume, image_service, image_id):
     """Copy the volume to the specified image."""
     volume_path = self.local_path(volume)
     with utils.temporary_chown(volume_path):
         with utils.file_open(volume_path) as volume_file:
             image_service.update(context, image_id, {}, volume_file)
Пример #3
0
 def copy_image_to_volume(self, context, volume, image_service, image_id):
     """Fetch the image from image_service and write it to the volume."""
     volume_path = self.local_path(volume)
     with utils.temporary_chown(volume_path):
         with utils.file_open(volume_path, "wb") as image_file:
             image_service.download(context, image_id, image_file)
Пример #4
0
 def copy_image_to_volume(self, context, volume, image_service, image_id):
     """Fetch the image from image_service and write it to the volume."""
     volume_path = self.local_path(volume)
     with utils.temporary_chown(volume_path):
         with utils.file_open(volume_path, "wb") as image_file:
             image_service.download(context, image_id, image_file)