ERROR Guest name ‘img-build-centos7-amd64’ is already in use.

For whatever reason, the maas-image-builder script for CentOS 7 does not like our local mirror.  We’ll investigate further.  But the problem is that it leaves the qemu vm in a bit of a half baked state.  The process fails, but it doesn’t clean up after itself.  No matter, as we can just as easily do that ourselves.

root@tnewman3:~/maas-image-builder# ./bin/build centos amd64 –centos-edition 7
Formatting ‘/tmp/img-builder-3Eef5T/disk.img’, fmt=raw size=5368709120
WARNING  KVM acceleration not available, using ‘qemu’
ERROR    Guest name ‘img-build-centos7-amd64’ is already in use.
Traceback (most recent call last):
  File “./bin/build”, line 45, in
    sys.exit(main(args))
  File “/root/maas-image-builder/builder/main.py”, line 108, in main
    osystem.build_image(args)
  File “/root/maas-image-builder/builder/osystems/centos.py”, line 101, in build_image
    super(CentOS, self).build_image(params)
  File “/root/maas-image-builder/builder/osystems/__init__.py”, line 158, in build_image
    extra_args=extra_arguments)
  File “/root/maas-image-builder/builder/virt.py”, line 76, in install_location
    subprocess.check_call(args)
  File “/usr/lib/python2.7/subprocess.py”, line 540, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command ‘[u’virt-install’, u’–name’, u’img-build-centos7-amd64′, u’–ram’, u’2048′, u’–arch’, u’x86_64′, u’–vcpus’, u’1′, u’–os-type’, u’linux’, u’–os-variant’, u’rhel5′, u’–disk’, u’path=/tmp/img-builder-3Eef5T/disk.img,format=raw’, u’–network’, u’bridge=virbr0,model=virtio’, u’–location’, u’http://yum.tamu.edu/centos/7/os/x86_64′, u’–initrd-inject=/root/maas-image-builder/contrib/centos/centos7/centos7-amd64.ks’, u’–extra-args=console=ttyS0 inst.ks=file:/centos7-amd64.ks text inst.cmdline inst.headless’, u’–noreboot’, u’–nographics’, u’–force’]’ returned non-zero exit status 1
root@tnewman3:~/maas-image-builder# virsh list –all
 Id    Name                           State
—————————————————-
 4     img-build-centos7-amd64        running

root@tnewman3:~/maas-image-builder# virsh undefine  img-build-centos7-amd64
Domain img-build-centos7-amd64 has been undefined

root@tnewman3:~/maas-image-builder# virsh list –all
 Id    Name                           State
—————————————————-
 4     img-build-centos7-amd64        running

root@tnewman3:~/maas-image-builder# virsh destroy  img-build-centos7-amd64
Domain img-build-centos7-amd64 destroyed

root@tnewman3:~/maas-image-builder# virsh list –all
 Id    Name                           State
—————————————————-

root@tnewman3:~/maas-image-builder#
Now we can set about the task of building the image once more.