Exemple #1
0
 def execute_impl(self, disk_path):
     metadata = image.snapshot_metadata(self.context, self.image_api,
                                        self.image_id, self.instance)
     LOG.info(_LI("Starting stream of boot device for instance %(inst)s "
                  "(local blockdev %(devpath)s) to glance image "
                  "%(img_id)s."),
              {'inst': self.instance.name, 'devpath': disk_path,
               'img_id': self.image_id}, instance=self.instance)
     image.stream_blockdev_to_glance(self.context, self.image_api,
                                     self.image_id, metadata, disk_path)
Exemple #2
0
 def execute(self, disk_path):
     metadata = image.snapshot_metadata(self.context, self.image_api,
                                        self.image_id, self.instance)
     LOG.info(
         "Starting stream of boot device (local blockdev %(devpath)s) "
         "to glance image %(img_id)s.", {
             'devpath': disk_path,
             'img_id': self.image_id
         },
         instance=self.instance)
     image.stream_blockdev_to_glance(self.context, self.image_api,
                                     self.image_id, metadata, disk_path)
Exemple #3
0
 def execute_impl(self, disk_path):
     metadata = image.snapshot_metadata(self.context, self.image_api,
                                        self.image_id, self.instance)
     LOG.info(_LI("Starting stream of boot device for instance %(inst)s "
                  "(local blockdev %(devpath)s) to glance image "
                  "%(img_id)s."), {
                      'inst': self.instance.name,
                      'devpath': disk_path,
                      'img_id': self.image_id
                  },
              instance=self.instance)
     image.stream_blockdev_to_glance(self.context, self.image_api,
                                     self.image_id, metadata, disk_path)
Exemple #4
0
 def test_snapshot_metadata(self, mock_api):
     mock_api.get.return_value = {'name': 'image_name'}
     mock_instance = mock.Mock()
     mock_instance.project_id = 'project_id'
     ret = image.snapshot_metadata('context', mock_api, 'image_id',
                                   mock_instance)
     mock_api.get.assert_called_with('context', 'image_id')
     self.assertEqual({
         'name': 'image_name',
         'is_public': False,
         'status': 'active',
         'disk_format': 'raw',
         'container_format': 'bare',
         'properties': {
             'image_location': 'snapshot',
             'image_state': 'available',
             'owner_id': 'project_id',
         }
     }, ret)
Exemple #5
0
 def test_snapshot_metadata(self, mock_api):
     mock_api.get.return_value = {'name': 'image_name'}
     mock_instance = mock.Mock()
     mock_instance.project_id = 'project_id'
     ret = image.snapshot_metadata('context', mock_api, 'image_id',
                                   mock_instance)
     mock_api.get.assert_called_with('context', 'image_id')
     self.assertEqual(
         {
             'name': 'image_name',
             'is_public': False,
             'status': 'active',
             'disk_format': 'raw',
             'container_format': 'bare',
             'properties': {
                 'image_location': 'snapshot',
                 'image_state': 'available',
                 'owner_id': 'project_id',
             }
         }, ret)