You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: volume_manager.rb
    path of file: ./repos/kontena/agent/lib/kontena/workers/volumes
    
    the code of the file until where you have to start completion: require_relative '../../models/volume'

module Kontena::Workers::Volumes
  class VolumeManager
    include Celluloid
    include Celluloid::Notifications
    include Kontena::Logging
    include Kontena::Helpers::RpcHelper
    include Kontena::Observer::Helper

    class DriverMismatchError < StandardError
    
    
    def populate_volumes_from_docker
      info "syncing volumes from docker"
      Docker::Volume.all.each do |volume|
        sync_volume_to_master(volume)
      end
    end

    # @param [Kontena::Models::Volume] volume
    def ensure_volume(volume)
      debug "ensuring volume existence: #{volume.inspect}"
      begin
        unless volume_exist?(volume.name, volume.driver)
          info "creating volume"
          v = Docker::Volume.create(volume.name, {
            'Driver' => volume.driver,
            'DriverOpts' => volume.driver_opts,
            'Labels' => volume.labels
          })
          sync_volume_to_master(v)
        end
      rescue => exc
        error "#{exc.class.name}: #{exc.message}"
        error exc.backtrace.join("\n") if exc.backtrace
      end