2017-05-27 03:49:56 |
Honghe Wu |
description |
We want to pdb debug of the code in the Kolla Cinder container:
So We add debug by following steps:
```
step 1, modify yml file of cinder_api:
stdin_open: true
tty: true
step 2:
docker attach cinder_api
```
The yml file we changed:
```
/usr/share/kolla-ansible/ansible/roles/cinder/detaults/main.yml:
cinder-volume:
container_name: cinder_volume
group: cinder-volume
enabled: true
image: "{{ cinder_volume_image_full }}"
privileged: True
ipc_mode: "host"
stdin_open: true # added
tty: true # added
/usr/share/kolla-ansible/ansible/roles/cinder/handlers/main.yml:
- name: Restart cinder-volume container
vars:
service_name: "cinder-volume"
service: "{{ cinder_services[service_name] }}"
config_json: "{{ cinder_config_jsons.results|selectattr('item.key', 'equalto', service_name)|first }}"
cinder_conf: "{{ cinder_confs.results|selectattr('item.key', 'equalto', service_name)|first }}"
policy_json: "{{ cinder_policy_jsons.results|selectattr('item.key', 'equalto', service_name)|first }}"
cinder_volume_container: "{{ check_cinder_containers.results|selectattr('item.key', 'equalto', service_name)|first }}"
kolla_docker:
action: "recreate_or_restart_container"
common_options: "{{ docker_common_options }}"
name: "{{ service.container_name }}"
image: "{{ service.image }}"
privileged: "{{ service.privileged | default(False) }}"
ipc_mode: "{{ service.ipc_mode | default('') }}"
volumes: "{{ service.volumes | reject('equalto', '') | list }}"
stdin_open: true # added
tty: true # added
/usr/share/kolla-ansible/ansible/roles/cinder/tasks/main.yml:
- name: Check cinder containers
kolla_docker:
action: "compare_container"
common_options: "{{ docker_common_options }}"
name: "{{ item.value.container_name }}"
image: "{{ item.value.image }}"
volumes: "{{ item.value.volumes | reject('equalto', '') | list }}"
privileged: "{{ item.value.privileged | default(False) }}"
ipc_mode: "{{ item.value.ipc_mode | default('') }}"
stdin_open: true # added
tty: true # added
```
when kolla-ansible reconfigure Cinder, the error log:
```
failed: [node1
] (item={'key': u'cinder-volume', 'value': {u'tty': True, u'group': u'cinder-volume', u'image': u'172.24.2.224: 4000/lokolla/centos-source-cinder-volume: 4.0.0', u'stdin_open': True, u'enabled': True, u'ipc_mode': u'host', u'volumes': [u'/etc/kolla//cinder-volume/:/var/lib/kolla/config_files/:ro', u'/etc/localtime:/etc/localtime:ro', u'/dev/:/dev/', u'/run/:/run/:shared', u'cinder:/var/lib/cinder', u'iscsi_info:/etc/iscsi', u'kolla_logs:/var/log/kolla/'
], u'container_name': u'cinder_volume', u'privileged': True
}
}) =>{
"failed": true,
"item": {
"key": "cinder-volume",
"value": {
"container_name": "cinder_volume",
"enabled": true,
"group": "cinder-volume",
"image": "172.24.2.224:4000/lokolla/centos-source-cinder-volume:4.0.0",
"ipc_mode": "host",
"privileged": true,
"stdin_open": true,
"tty": true,
"volumes": [
"/etc/kolla//cinder-volume/:/var/lib/kolla/config_files/:ro",
"/etc/localtime:/etc/localtime:ro",
"/dev/:/dev/",
"/run/:/run/:shared",
"cinder:/var/lib/cinder",
"iscsi_info:/etc/iscsi",
"kolla_logs:/var/log/kolla/"
]
}
},
"msg": "Unsupported parameters for (kolla_docker) module: stdin_open,tty. Supported parameters include: action,api_version,auth_email,auth_password,auth_registry,auth_username,cap_add,common_options,detach,environment,image,ipc_mode,labels,name,pid_mode,privileged,remove_on_exit,restart_policy,restart_retries,security_opt,tls_cacert,tls_cert,tls_key,tls_verify,volumes,volumes_from"
}
``` |
We want to pdb debug of the Python code in the Kolla Cinder container:
So We add debug by following steps:
```
step 1, modify yml file of cinder_api:
stdin_open: true
tty: true
step 2:
docker attach cinder_api
```
The yml file we changed:
```
/usr/share/kolla-ansible/ansible/roles/cinder/detaults/main.yml:
cinder-volume:
container_name: cinder_volume
group: cinder-volume
enabled: true
image: "{{ cinder_volume_image_full }}"
privileged: True
ipc_mode: "host"
stdin_open: true # added
tty: true # added
/usr/share/kolla-ansible/ansible/roles/cinder/handlers/main.yml:
- name: Restart cinder-volume container
vars:
service_name: "cinder-volume"
service: "{{ cinder_services[service_name] }}"
config_json: "{{ cinder_config_jsons.results|selectattr('item.key', 'equalto', service_name)|first }}"
cinder_conf: "{{ cinder_confs.results|selectattr('item.key', 'equalto', service_name)|first }}"
policy_json: "{{ cinder_policy_jsons.results|selectattr('item.key', 'equalto', service_name)|first }}"
cinder_volume_container: "{{ check_cinder_containers.results|selectattr('item.key', 'equalto', service_name)|first }}"
kolla_docker:
action: "recreate_or_restart_container"
common_options: "{{ docker_common_options }}"
name: "{{ service.container_name }}"
image: "{{ service.image }}"
privileged: "{{ service.privileged | default(False) }}"
ipc_mode: "{{ service.ipc_mode | default('') }}"
volumes: "{{ service.volumes | reject('equalto', '') | list }}"
stdin_open: true # added
tty: true # added
/usr/share/kolla-ansible/ansible/roles/cinder/tasks/main.yml:
- name: Check cinder containers
kolla_docker:
action: "compare_container"
common_options: "{{ docker_common_options }}"
name: "{{ item.value.container_name }}"
image: "{{ item.value.image }}"
volumes: "{{ item.value.volumes | reject('equalto', '') | list }}"
privileged: "{{ item.value.privileged | default(False) }}"
ipc_mode: "{{ item.value.ipc_mode | default('') }}"
stdin_open: true # added
tty: true # added
```
when kolla-ansible reconfigure Cinder, the error log:
```
failed: [node1
] (item={'key': u'cinder-volume', 'value': {u'tty': True, u'group': u'cinder-volume', u'image': u'172.24.2.224: 4000/lokolla/centos-source-cinder-volume: 4.0.0', u'stdin_open': True, u'enabled': True, u'ipc_mode': u'host', u'volumes': [u'/etc/kolla//cinder-volume/:/var/lib/kolla/config_files/:ro', u'/etc/localtime:/etc/localtime:ro', u'/dev/:/dev/', u'/run/:/run/:shared', u'cinder:/var/lib/cinder', u'iscsi_info:/etc/iscsi', u'kolla_logs:/var/log/kolla/'
], u'container_name': u'cinder_volume', u'privileged': True
}
}) =>{
"failed": true,
"item": {
"key": "cinder-volume",
"value": {
"container_name": "cinder_volume",
"enabled": true,
"group": "cinder-volume",
"image": "172.24.2.224:4000/lokolla/centos-source-cinder-volume:4.0.0",
"ipc_mode": "host",
"privileged": true,
"stdin_open": true,
"tty": true,
"volumes": [
"/etc/kolla//cinder-volume/:/var/lib/kolla/config_files/:ro",
"/etc/localtime:/etc/localtime:ro",
"/dev/:/dev/",
"/run/:/run/:shared",
"cinder:/var/lib/cinder",
"iscsi_info:/etc/iscsi",
"kolla_logs:/var/log/kolla/"
]
}
},
"msg": "Unsupported parameters for (kolla_docker) module: stdin_open,tty. Supported parameters include: action,api_version,auth_email,auth_password,auth_registry,auth_username,cap_add,common_options,detach,environment,image,ipc_mode,labels,name,pid_mode,privileged,remove_on_exit,restart_policy,restart_retries,security_opt,tls_cacert,tls_cert,tls_key,tls_verify,volumes,volumes_from"
}
``` |
|