'Calculate an I/O based load by counting I/O heavy operations.'

@property
def io_workload(self):

    def _get(state, state_type):
        key = ('num_%s_%s' % (state_type, state))
        return self.get(key, 0)
    num_builds = _get(vm_states.BUILDING, 'vm')
    num_migrations = _get(task_states.RESIZE_MIGRATING, 'task')
    num_rebuilds = _get(task_states.REBUILDING, 'task')
    num_resizes = _get(task_states.RESIZE_PREP, 'task')
    num_snapshots = _get(task_states.IMAGE_SNAPSHOT, 'task')
    num_backups = _get(task_states.IMAGE_BACKUP, 'task')
    num_rescues = _get(task_states.RESCUING, 'task')
    num_unshelves = _get(task_states.UNSHELVING, 'task')
    return (((((((num_builds + num_rebuilds) + num_resizes) + num_migrations) + num_snapshots) + num_backups) + num_rescues) + num_unshelves)
