Fix AttributeError: 'VM' object has no attribute 'vm'

ERROR:uncloud.vmm:Error occurred while starting VM.
Detail qemu-system-x86_64: -drive file=/home/nico/vcs/uncloud/uncloud/hack/hackcloud/alpine-virt-3.11.2-x86_64.iso,format=qcow2,if=virtio: Image is not in qcow2 format
Traceback (most recent call last):
  File "/home/nico/vcs/uncloud/uncloud/vmm/__init__.py", line 186, in start
    sp.check_output(command, stderr=sp.PIPE)
  File "/usr/lib/python3.8/subprocess.py", line 411, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
  File "/usr/lib/python3.8/subprocess.py", line 512, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['sudo', '-p', 'Enter password to start VM 87230168-1b74-49f7-97c3-c968a26fc65e: ', '/usr/bin/qemu-system-x86_64', '-name', 'uncoud-87230168-1b74-49f7-97c3-c968a26fc65e', '-machine', 'pc,accel=kvm', '-drive', 'file=/home/nico/vcs/uncloud/uncloud/hack/hackcloud/alpine-virt-3.11.2-x86_64.iso,format=qcow2,if=virtio', '-device', 'virtio-rng-pci', '-m', '1024M', '-smp', 'cores=1,threads=1', '-netdev', 'tap,id=netmain,script=/home/nico/vcs/uncloud/uncloud/hack/hackcloud/ifup.sh,downscript=/home/nico/vcs/uncloud/uncloud/hack/hackcloud/ifdown.sh,ifname=uc000000000000', '-device', 'virtio-net-pci,netdev=netmain,id=net0,mac=42:00:00:00:00:01', '-qmp', 'unix:/home/nico/vcs/uncloud/uncloud/hack/hackcloud/sock/87230168-1b74-49f7-97c3-c968a26fc65e,server,nowait', '-vnc', 'unix:/tmp/tmpep71nz1f', '-daemonize']' returned non-zero exit status 1.
ERROR:root:'VM' object has no attribute 'vm'
Traceback (most recent call last):
  File "./bin/../scripts/uncloud", line 82, in <module>
    main(arguments)
  File "/home/nico/vcs/uncloud/uncloud/hack/main.py", line 47, in main
    vm.create()
  File "/home/nico/vcs/uncloud/uncloud/hack/vm.py", line 115, in create
    self.vm['mac'] = self.mac
AttributeError: 'VM' object has no attribute 'vm'
(venv) [18:49] diamond:uncloud% ./bin/uncloud-run-reinstall hack --create-vm --hackprefix ~/vcs/uncloud/uncloud/hack/hackcloud/ --image alpine-virt-3.11.2-x86_64.iso --no-db
This commit is contained in:
Nico Schottelius 2020-01-29 19:30:19 +01:00
parent 1b08a49aef
commit 56565ac7f7

View file

@ -100,6 +100,7 @@ class VM(object):
def create(self):
# New VM: new UUID, new MAC.
self.uuid = str(uuid.uuid4())
self.mac=MAC(self.config)
self.mac.create()
qemu_args = self.get_qemu_args()
@ -110,7 +111,7 @@ class VM(object):
*qemu_args
)
self.mac=MAC(self.config)
self.mac.create()
self.vm['mac'] = self.mac
self.vm['ifname'] = "uc{}".format(self.mac.__repr__())
@ -159,4 +160,3 @@ class VM(object):
def list(self):
print(self.vmm.discover())