Commit ce3bd422 by Heechul Kim

updated

parent 7452abfb
...@@ -9,6 +9,7 @@ import stat ...@@ -9,6 +9,7 @@ import stat
import shutil import shutil
import signal import signal
import tarfile import tarfile
import tempfile
import logging import logging
import logging.config import logging.config
...@@ -387,7 +388,11 @@ def install_machine(data): ...@@ -387,7 +388,11 @@ def install_machine(data):
s_cmd = "{} -I lanplus -H {} -U {} -f {} chassis bootdev pxe"\ s_cmd = "{} -I lanplus -H {} -U {} -f {} chassis bootdev pxe"\
.format(IPMITOOL, d['ipmi_ip'], IPMIUSER, s_tmp) .format(IPMITOOL, d['ipmi_ip'], IPMIUSER, s_tmp)
log.debug(s_cmd) log.debug(s_cmd)
Popen(s_cmd, shell=True) (b_ret, l_out) = cmd(s_cmd)
if not b_ret:
log.error('IPMI bootdev pxe is failed: {}'.format(l_out))
else:
log.info('IPMI bootdev pxe is succeeded: {}'.format(l_out))
# update machine state to 'Installing' # update machine state to 'Installing'
d['state'] = 'Installing' d['state'] = 'Installing'
...@@ -424,14 +429,14 @@ def install_machine(data): ...@@ -424,14 +429,14 @@ def install_machine(data):
# power on the physical machines if any. # power on the physical machines if any.
if len(l_ipmi): if len(l_ipmi):
for ipmi_ip in l_ipmi: for ipmi_ip in l_ipmi:
s_cmd = "{} -I lanplus -H {} -U {} -f {} chassis power reset"\ s_cmd = "{} -I lanplus -H {} -U {} -f {} chassis power cycle"\
.format(IPMITOOL, ipmi_ip, IPMIUSER, s_tmp) .format(IPMITOOL, ipmi_ip, IPMIUSER, s_tmp)
(b_ret, l_out) = cmd(s_cmd) (b_ret, l_out) = cmd(s_cmd)
if not b_ret: if not b_ret:
log.error('IPMI Reset is failed: {}'.format(l_out)) log.error('IPMI power cycle is failed: {}'.format(l_out))
else: else:
log.info('IPMI Reset is succeeded: {}'.format(l_out)) log.info('IPMI power cycle is succeeded: {}'.format(l_out))
# delete s_tmp # delete s_tmp
os.unlink(s_tmp) os.unlink(s_tmp)
...@@ -467,22 +472,18 @@ def show_console_machine(name): ...@@ -467,22 +472,18 @@ def show_console_machine(name):
d = ast.literal_eval(r.value) d = ast.literal_eval(r.value)
ipmi_ip = d['ipmi_ip'] ipmi_ip = d['ipmi_ip']
#s_tmp = '/tmp/pass' s_tmp = '/tmp/{}.pass'.format(name)
#with open(s_tmp, 'w') as f: with open(s_tmp, 'w') as f:
# f.write(IPMIPASS) f.write(IPMIPASS)
# deactivate first. # deactivate first.
#s_cmd = '{} -I lanplus -H {} -U {} -f {} sol deactivate'\ s_cmd = '{} -I lanplus -H {} -U {} -f {} sol deactivate'\
# .format(IPMITOOL, ipmi_ip, IPMIUSER, s_tmp) .format(IPMITOOL, ipmi_ip, IPMIUSER, s_tmp)
s_cmd = '{} -h {} -u {} -p "{}" --deactivate'\
.format(IPMICONSOLE, ipmi_ip, IPMIUSER, IPMIPASS)
log.debug(s_cmd) log.debug(s_cmd)
cmd(s_cmd) cmd(s_cmd)
s_pidfile = '/tmp/{}.pid'.format(name) s_pidfile = '/tmp/{}.pid'.format(name)
# run terminal to connect to a machine # run terminal to connect to a machine
#ipmi_cmd = '{} -I lanplus -H {} -U {} -f {} sol activate'\ ipmi_cmd = '{} -I lanplus -H {} -U {} -f {} sol activate'\
# .format(IPMITOOL, ipmi_ip, IPMIUSER, s_tmp) .format(IPMITOOL, ipmi_ip, IPMIUSER, s_tmp)
ipmi_cmd = '{} -h {} -u {} -p "{}"'\
.format(IPMICONSOLE, ipmi_ip, IPMIUSER, IPMIPASS)
s_cmd = "shellinaboxd --background={} ".format(s_pidfile) + \ s_cmd = "shellinaboxd --background={} ".format(s_pidfile) + \
"--service='/:{0}:{0}:/:{1}' ".format(PORCH_USER, ipmi_cmd) + \ "--service='/:{0}:{0}:/:{1}' ".format(PORCH_USER, ipmi_cmd) + \
"-p {} --disable-ssl -q ".format(i_port) + \ "-p {} --disable-ssl -q ".format(i_port) + \
...@@ -490,13 +491,16 @@ def show_console_machine(name): ...@@ -490,13 +491,16 @@ def show_console_machine(name):
log.debug(s_cmd) log.debug(s_cmd)
Popen(s_cmd, shell=True) Popen(s_cmd, shell=True)
# delete s_tmp after 3 seconds.
#os.unlink(s_tmp)
return (True, i_port) return (True, i_port)
def close_console_machine(name): def close_console_machine(name):
"""close console.""" """close console."""
# Delete pass file.
s_tmp = '/tmp/{}.pass'.format(name)
try:
os.remove(s_tmp)
except:
pass # ignore.
# check if terminal is running. # check if terminal is running.
s_pidfile = '/tmp/{}.pid'.format(name) s_pidfile = '/tmp/{}.pid'.format(name)
if os.path.isfile(s_pidfile): if os.path.isfile(s_pidfile):
......
...@@ -10,6 +10,11 @@ ...@@ -10,6 +10,11 @@
name: openssl-devel name: openssl-devel
state: present state: present
- name: Ensure the bind-utils package installed
yum:
name: bind-utils
state: present
- name: Get bind source tarball from ftp://ftp.isc.org. - name: Get bind source tarball from ftp://ftp.isc.org.
get_url: get_url:
url: http://ftp.isc.org/isc/bind9/{{ d['tag'] }}/bind-{{ d['tag'] }}.tar.gz url: http://ftp.isc.org/isc/bind9/{{ d['tag'] }}/bind-{{ d['tag'] }}.tar.gz
...@@ -22,7 +27,7 @@ ...@@ -22,7 +27,7 @@
remote_src: True remote_src: True
- name: configure bind. - name: configure bind.
shell: ./configure --prefix=/usr/local/bind-{{ d['tag'] }} --sysconfdir=/etc --enable-querytrace --with-tuning=large --enable-threads --enable-full-report shell: ./configure --prefix=/usr/local/bind-{{ d['tag'] }} --sysconfdir=/etc --enable-querytrace --localstatedir=/data/var --with-tuning=large --enable-threads --enable-full-report
args: args:
chdir: /tmp/bind-{{ d['tag'] }} chdir: /tmp/bind-{{ d['tag'] }}
...@@ -103,6 +108,12 @@ ...@@ -103,6 +108,12 @@
state: directory state: directory
mode: 0755 mode: 0755
- name: Make directory /data/var/run
file:
path: /data/var/run
state: directory
mode: 0755
- name: Change ownership of /data to named:named - name: Change ownership of /data to named:named
command: chown -R named:named /data command: chown -R named:named /data
......
...@@ -2,4 +2,4 @@ default porch-generated ...@@ -2,4 +2,4 @@ default porch-generated
label porch-generated label porch-generated
kernel {{ data['fai_kernel_url'] }} kernel {{ data['fai_kernel_url'] }}
append initrd={{ data['fai_initrd_url'] }} ip=dhcp root=live:{{ data['fai_squash_url'] }} aufs FAI_FLAGS=verbose,sshd,reboot FAI_CONFIG_SRC={{ data['fai_config_url'] }} FAI_ACTION=install {% if data['type'] == 'PM' %} console=tty0 console=ttyS1,115200n8 {% endif %} net.ifnames=0 edd=off append initrd={{ data['fai_initrd_url'] }} ip=dhcp root=live:{{ data['fai_squash_url'] }} aufs FAI_FLAGS=verbose,sshd,reboot FAI_CONFIG_SRC={{ data['fai_config_url'] }} FAI_ACTION=install {% if data['type'] == 'PM' %} console=tty0 console=ttyS0,115200n8 {% endif %} net.ifnames=0 edd=off
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment