On Thu, Jun 26, 2008 at 12:47:27PM -0400, "Bryan M. Kearney <[EMAIL 
PROTECTED]>"@redhat.com wrote:
> +                    if vm.ID() == -1:
> +                        logging.info("Removing old definition for image %s" 
> %(self.name))
> +                        vm.undefine()
> +                    else:
> +                        logging.info("Destroying image %s" %(self.name))     
>       
> +                        vm.destroy()

You don't want this to be an either / or conditional. If the VM exists
you should *always* attempt to undefine it - a running VM may or may
not have a config file

So you want something closer to

     if vm.ID() != -1:
        vm.destroy()

     try:
        vm.undefine()
     except:
        pass

Daniel
-- 
|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

_______________________________________________
et-mgmt-tools mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/et-mgmt-tools

Reply via email to