简体   繁体   中英

how can I solve lxc container journal mount problem

I have lxc contariner with the line at its own config

lxc.mount.entry = /var/log/journal/56abd83f52ed4b53b6bd4c41f3564179 var/log/journal/56abd83f52ed4b53b6bd4c41f3564179 none bind,create=dir 0 0

but they are not synced. the directory in hosts is older than inside container and i create another line

lxc.mount.entry = /srv/log/machine1 var/log none bind,create=dir 0 0

it works perfectly fine for some container and doesnt work for the others.

what's the reason of that

the problem was the order of mount. its been fixed in openstack victoria

insertbefore section was added. in upgrade ussuri to victoria we should do it manually.

so the order is like this

first var/log

then /var/log/journal

- name: Add bind mount configuration to container
  lineinfile:
    dest: "/var/lib/lxc/{{ inventory_hostname }}/config"
    line: "lxc.mount.entry = {{ item['mount_path'] }} {{ item['bind_dir_path'].lstrip('/') }} none bind,create=dir 0 0"
    insertbefore: "^lxc.mount.entry = .*\\s{{ item['bind_dir_path'].lstrip('/') | regex_replace('/', '\/') }}.*"
    backup: "true"
  with_items:
    - "{{ lxc_default_bind_mounts | default([]) }}"
    - "{{ list_of_bind_mounts | default([]) }}"
  delegate_to: "{{ physical_host }}"
  register: _mc
  tags:
    - common-lxc

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM