Fix and break some VM stuff
This commit is contained in:
parent
b1319d654a
commit
ae3482cc71
1 changed files with 9 additions and 4 deletions
|
@ -36,8 +36,8 @@ class VM(object):
|
||||||
self.db = DB(self.config, prefix="/vm")
|
self.db = DB(self.config, prefix="/vm")
|
||||||
|
|
||||||
#TODO: Select generic
|
#TODO: Select generic
|
||||||
#self.hackprefix="/home/nico/vcs/uncloud/uncloud/hack/hackcloud" #TODO: Should be removed midterm
|
self.hackprefix="/home/nico/vcs/uncloud/uncloud/hack/hackcloud" #TODO: Should be removed midterm
|
||||||
self.hackprefix="/home/rouxdo/Work/ungleich/uncloud/uncloud/hack/hackcloud" #TODO: Dominique testing
|
#self.hackprefix="/home/rouxdo/Work/ungleich/uncloud/uncloud/hack/hackcloud" #TODO: Dominique testing
|
||||||
self.qemu="/usr/bin/qemu-system-x86_64" #TODO: should be in config
|
self.qemu="/usr/bin/qemu-system-x86_64" #TODO: should be in config
|
||||||
self.accel="kvm" #TODO: should be config
|
self.accel="kvm" #TODO: should be config
|
||||||
|
|
||||||
|
@ -67,14 +67,19 @@ class VM(object):
|
||||||
#self.vni_hex = "{:x}".format(self.config.arguments['vni'])
|
#self.vni_hex = "{:x}".format(self.config.arguments['vni'])
|
||||||
self.bridgedev = "br{}".format("{:x}".format(self.config.arguments['vni']))
|
self.bridgedev = "br{}".format("{:x}".format(self.config.arguments['vni']))
|
||||||
|
|
||||||
#TODO: Enable sudo
|
#TODO: Enable sudo -- FIXME!
|
||||||
if self.config.arguments['use_sudo']:
|
if self.config.arguments['use_sudo']:
|
||||||
self.sudo = "sudo"
|
self.sudo = "sudo"
|
||||||
|
else:
|
||||||
|
self.sudo = ""
|
||||||
|
|
||||||
|
|
||||||
self.mac=MAC(self.config)
|
self.mac=MAC(self.config)
|
||||||
self.mac.create()
|
self.mac.create()
|
||||||
self.vm['ifname'] = "uc{}".format(self.mac.to_str_format())
|
self.vm['ifname'] = "uc{}".format(self.mac.to_str_format())
|
||||||
|
|
||||||
|
# FIXME: TODO: turn this into a string and THEN
|
||||||
|
# .split() it later -- easier for using .format()
|
||||||
#self.vm['commandline'] = [ "{}".format(self.sudo),
|
#self.vm['commandline'] = [ "{}".format(self.sudo),
|
||||||
self.vm['commandline'] = [ "{}".format(self.sudo),
|
self.vm['commandline'] = [ "{}".format(self.sudo),
|
||||||
"{}".format(self.qemu),
|
"{}".format(self.qemu),
|
||||||
|
@ -84,7 +89,7 @@ class VM(object):
|
||||||
"-smp", "{}".format(self.vm['cores']),
|
"-smp", "{}".format(self.vm['cores']),
|
||||||
"-uuid", "{}".format(self.vm['uuid']),
|
"-uuid", "{}".format(self.vm['uuid']),
|
||||||
"-drive", "file={},media=cdrom".format(self.vm['os_image']),
|
"-drive", "file={},media=cdrom".format(self.vm['os_image']),
|
||||||
"-netdev", "tap,id=netmain,script={},downscript={},ifname={}".format(self.ifup, self.ifdown, self.mac),
|
"-netdev", "tap,id=netmain,script={},downscript={},ifname={}".format(self.ifup, self.ifdown, self.vm['ifname']),
|
||||||
"-device", "virtio-net-pci,netdev=netmain,id=net0,mac={}".format(self.mac)
|
"-device", "virtio-net-pci,netdev=netmain,id=net0,mac={}".format(self.mac)
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue