[virt-tools-list] [PATCH v3 5/6] Do not use createXML for non transient domains

Cole Robinson crobinso at redhat.com
Wed Mar 1 20:38:53 UTC 2017


On 02/21/2017 09:27 AM, Mikhail Feoktistov wrote:
> For these domains use defineXML
> Also do not call secocd defineXML if install_xml == final_xml
> ---
>  virtinst/guest.py | 12 +++++++-----
>  1 file changed, 7 insertions(+), 5 deletions(-)
> 
> diff --git a/virtinst/guest.py b/virtinst/guest.py
> index ae23847..dd579ff 100644
> --- a/virtinst/guest.py
> +++ b/virtinst/guest.py
> @@ -393,12 +393,14 @@ class Guest(XMLBuilder):
>          meter = util.ensure_meter(meter)
>          meter.start(size=None, text=meter_label)
>  
> -        if doboot or transient or self.installer.has_install_phase():
> +        if transient:
>              self.domain = self.conn.createXML(install_xml or final_xml, 0)
> -
> -        if not transient:
> -            self.domain = self.conn.defineXML(final_xml)
> -        meter.end(0)
> +        else:
> +            self.domain = self.conn.defineXML(install_xml or final_xml)
> +            if doboot or self.installer.has_install_phase():
> +                self.domain.create()
> +            if install_xml != None and install_xml != final_xml:
> +                self.domain = self.conn.defineXML(final_xml)
>  
>          try:
>              logging.debug("XML fetched from libvirt object:\n%s",
> 

I updated this to do domain.undefine() if the domain.create() step fails,
which is the behavior we want to preserve from the usage of createXML, and
pushed it

Thanks,
Cole




More information about the virt-tools-list mailing list