new version with QEMU
This commit is contained in:
parent
ceded625f4
commit
f77174de31
3 changed files with 6 additions and 9 deletions
|
@ -163,7 +163,8 @@ class QEMU:
|
||||||
f.close()
|
f.close()
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def create(self, cores, memory, storage, swap, hostname, ipv4, dns1, dns2, password, os_name, os_suite, ssh_key=None):
|
def create(self, cores, memory, storage, swap, hostname, ipv4, ipv4_gateway, dns1, dns2,
|
||||||
|
password, os_name, os_suite, interface, ssh_key=None):
|
||||||
"""
|
"""
|
||||||
функция создания виртуальной машины
|
функция создания виртуальной машины
|
||||||
"""
|
"""
|
||||||
|
@ -180,10 +181,6 @@ class QEMU:
|
||||||
|
|
||||||
# TODO: move to settings file
|
# TODO: move to settings file
|
||||||
mirror = "http://ru.archive.ubuntu.com/ubuntu/"
|
mirror = "http://ru.archive.ubuntu.com/ubuntu/"
|
||||||
# TODO: move to settings file
|
|
||||||
gw = "192.168.1.254"
|
|
||||||
# TODO: move to settings file
|
|
||||||
interface = 'br0'
|
|
||||||
|
|
||||||
c = [
|
c = [
|
||||||
"cd",
|
"cd",
|
||||||
|
@ -198,7 +195,7 @@ class QEMU:
|
||||||
"-o",
|
"-o",
|
||||||
"--libvirt=qemu:///system",
|
"--libvirt=qemu:///system",
|
||||||
"--ip=%s" % ipv4,
|
"--ip=%s" % ipv4,
|
||||||
"--gw=%s" % gw,
|
"--gw=%s" % ipv4_gateway,
|
||||||
# PARTITIONING
|
# PARTITIONING
|
||||||
# "--part=/var/lib/qemu/images/%s/partition" % values['hostname'],
|
# "--part=/var/lib/qemu/images/%s/partition" % values['hostname'],
|
||||||
"--rootsize=%s" % storage,
|
"--rootsize=%s" % storage,
|
||||||
|
|
|
@ -137,8 +137,8 @@ while True:
|
||||||
try:
|
try:
|
||||||
qemu.QEMU().create(
|
qemu.QEMU().create(
|
||||||
p['cores'], p['memory'], p['storage'], p['swap'], p['hostname'],
|
p['cores'], p['memory'], p['storage'], p['swap'], p['hostname'],
|
||||||
p['ipv4'], p['dns1'], p['dns2'], p['password'],
|
p['ipv4'], p['ipv4_gateway'], p['dns1'], p['dns2'], p['password'],
|
||||||
p['os_name'], p['os_suite'], p['ssh_key']
|
p['os_name'], p['os_suite'], settings.get('node', 'interface'), p['ssh_key']
|
||||||
)
|
)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logging.warning(e)
|
logging.warning(e)
|
||||||
|
|
2
setup.py
2
setup.py
|
@ -4,7 +4,7 @@ from setuptools import setup
|
||||||
|
|
||||||
setup(
|
setup(
|
||||||
name='SWSCloudNode',
|
name='SWSCloudNode',
|
||||||
version='3.0.1-beta',
|
version='3.0.1-beta2',
|
||||||
author='Vyacheslav Anzhiganov',
|
author='Vyacheslav Anzhiganov',
|
||||||
author_email='vanzhiganov@ya.ru',
|
author_email='vanzhiganov@ya.ru',
|
||||||
packages=[
|
packages=[
|
||||||
|
|
Loading…
Add table
Reference in a new issue