forked from uncloud/uncloud
Integrate hack + vm create into python code
This commit is contained in:
parent
22531a7459
commit
083ba43918
3 changed files with 65 additions and 54 deletions
|
|
@ -1,53 +0,0 @@
|
|||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# 2020 Nico Schottelius (nico.schottelius at ungleich.ch)
|
||||
#
|
||||
# This file is part of uncloud.
|
||||
#
|
||||
# uncloud is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# uncloud is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with uncloud. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
#
|
||||
|
||||
import subprocess
|
||||
import uuid
|
||||
|
||||
from . import db
|
||||
|
||||
qemu="/usr/bin/qemu-system-x86_64"
|
||||
accel="kvm"
|
||||
memory=1024
|
||||
cores=2
|
||||
uuid=uuid.uuid4()
|
||||
|
||||
#mac=$(./mac-gen.py)
|
||||
mac=""
|
||||
|
||||
owner="nico"
|
||||
|
||||
bridge="br100"
|
||||
|
||||
if __name__ == '__main__':
|
||||
p = ["qemu",
|
||||
"-name", "uncloud-{}".format(uuid),
|
||||
"-machine", "pc,accel={}".format(accel),
|
||||
"-m", "{}".format(memory),
|
||||
"-smp", "{}".format(cores),
|
||||
"-uuid", "{}".format(uuid),
|
||||
"-drive", "file=alpine-virt-3.11.2-x86_64.iso,media=cdrom",
|
||||
"-netdev", "tap,id=netmain,script=./ifup.sh,downscript=./ifdown.sh",
|
||||
"-device", "virtio-net-pci,netdev=netmain,id=net0,mac={}".format(mac)
|
||||
]
|
||||
print(" ".join(p))
|
||||
subprocess.run(p)
|
||||
Loading…
Add table
Add a link
Reference in a new issue