Commit 954fedda authored by Thomas Goirand's avatar Thomas Goirand

Set the HostMin as url for apt when installing.

parent e54ef029
......@@ -13,7 +13,7 @@ cat /etc/openstack-cluster-installer/openstack-cluster-installer.conf | grep -v
. ${TMPFILE}
rm ${TMPFILE}
qemu-img create /var/lib/openstack-cluster-installer/openstack-cluster-installer-scratch-disk.dat 150G
qemu-img create /var/lib/openstack-cluster-installer/openstack-cluster-installer-scratch-disk.dat 10G
/usr/bin/kvm \
-m size=6G \
......
#!/bin/sh
set -e
set -x
if ! [ -r /etc/openstack-cluster-installer/openstack-cluster-installer.conf ] ; then
echo "Could not load /etc/openstack-cluster-installer/openstack-cluster-installer.conf"
exit 1
fi
TMPFILE=$(mktemp -t openstack-cluster-installer.XXXXXX)
cat /etc/openstack-cluster-installer/openstack-cluster-installer.conf | grep -v '^\[' >${TMPFILE}
. ${TMPFILE}
rm ${TMPFILE}
/usr/bin/kvm \
-m size=6G \
-smp cpus=8 \
-cpu host \
-display sdl \
-pidfile /var/lib/openstack-cluster-installer/vm.pid \
-daemonize \
-name openstack-install-vm \
-drive if=virtio,file=/var/lib/openstack-cluster-installer/openstack-cluster-installer-scratch-disk.dat,index=0,media=disk,format=raw \
-device e1000,netdev=net0,mac=${QEMU_VM_MAC} \
-netdev tap,id=net0,ifname=${PXE_VM_VIRTAP_NAME},script=no,downscript=no \
-device e1000,netdev=net1,mac=08:00:27:06:CC:DE \
-netdev user,id=net1,net=172.17.1.0/24,dhcpstart=172.17.1.1
......@@ -33,7 +33,7 @@ print(machine_list($con));
if($_REQUEST["action"] == "install_os"){
print("Installing OS:<br>");
$ret = send_ssh_cmd($conf, $con, $_REQUEST["ipaddr"], "ls /");
$ret = send_ssh_cmd($conf, $con, $_REQUEST["ipaddr"], "build-openstack-debian-image --release stretch --debootstrap-url http://".$conf["network"]["hostmin"].":9999/debian --sources.list-mirror http://".$conf["network"]["hostmin"].":9999/debian --dest-hdd vda --no-cloud-init");
print($ret);
}
......
......@@ -3,6 +3,25 @@
function readmyconf() {
$conf = parse_ini_file("/etc/openstack-cluster-installer/openstack-cluster-installer.conf", true);
$conf["database"]["DSN"] = str_replace("+pymysql","", $conf["database"]["connection"]);
# Calculate network params to make it easier to write /etc/network/interfaces
$cidr = $conf["network"]["OPENSTACK_CLUSTER_NETWORK"];
list ($net, $mask) = split ("/", $cidr);
$conf["network"]["network"] = $net;
$conf["network"]["netmaskclass"] = $mask;
$output = "";
exec("ipcalc $cidr | grep HostMin | awk '{print \$2}'", $output);
$conf["network"]["hostmin"];
$output = "";
exec("ipcalc $cidr | grep HostMax | awk '{print \$2}'", $output);
$conf["network"]["hostmax"];
$output = "";
exec("ipcalc $cidr | grep Netmask | awk '{print \$2}'", $output);
$conf["network"]["netmask"];
$output = "";
exec("ipcalc $cidr | grep Broadcast | awk '{print \$2}'", $output);
$conf["network"]["broadcast"];
return $conf;
}
?>
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 to comment