'Backup the given instance
:param instance: nova.objects.instance.Instance object
:param name: name of the backup
:param backup_type: \'daily\' or \'weekly\'
:param rotation: int representing how many backups to keep around;
None if rotation shouldn\'t be used (as in the case of snapshots)
:param extra_properties: dict of extra image properties to include
when creating the image.
:returns: A dict containing image metadata'

@check_instance_cell
@check_instance_state(vm_state=[vm_states.ACTIVE, vm_states.STOPPED, vm_states.PAUSED, vm_states.SUSPENDED])
def backup(self, context, instance, name, backup_type, rotation, extra_properties=None):

    props_copy = dict(extra_properties, backup_type=backup_type)
    if compute_utils.is_volume_backed_instance(context, instance):
        LOG.info("It's    not    supported    to    backup    volume    backed    instance.", instance=instance)
        raise exception.InvalidRequest(_('Backup    is    not    supported    for    volume-backed    instances.'))
    else:
        image_meta = self._create_image(context, instance, name, 'backup', extra_properties=props_copy)
    instance.task_state = task_states.IMAGE_BACKUP
    instance.save(expected_task_state=[None])
    self.compute_rpcapi.backup_instance(context, instance, image_meta['id'], backup_type, rotation)
    return image_meta
