changeset 46:868d51208aa3

fix path
author AnaTofuZ <anatofuz@gmail.com>
date Sun, 22 Nov 2020 18:24:38 +0900
parents 91aea67d88fb
children 9a7ceb63efbc
files src/xml.rs
diffstat 1 files changed, 3 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/xml.rs	Sun Nov 22 18:06:30 2020 +0900
+++ b/src/xml.rs	Sun Nov 22 18:24:38 2020 +0900
@@ -205,15 +205,17 @@
                     let is_qcow_file = elem
                         .attributes()
                         .find(|attr| attr.as_ref().unwrap().key == b"file");
+                    let mut is_qcow_elem = false;
                     if is_qcow_file.is_some() {
                         elem.clear_attributes();
                         let qcow2_path: &str = &self.qcow2_path;
                         elem.push_attribute(("file", qcow2_path));
+                        is_qcow_elem = true;
                     }
                     writer.write_event(Event::Empty(elem)).ok();
 
                     // use template qcow2
-                    if self.is_backing {
+                    if is_qcow_elem && self.is_backing {
                         let mut backing_store_start = BytesStart::borrowed_name(b"backingStore");
                         backing_store_start.push_attribute(("type", "file"));
                         backing_store_start.push_attribute(("index", "3"));