comparison src/xml.rs @ 47:9a7ceb63efbc

fix emit xml
author AnaTofuZ <anatofuz@gmail.com>
date Sun, 22 Nov 2020 18:30:16 +0900
parents 868d51208aa3
children 871a98179dfe
comparison
equal deleted inserted replaced
46:868d51208aa3 47:9a7ceb63efbc
214 } 214 }
215 writer.write_event(Event::Empty(elem)).ok(); 215 writer.write_event(Event::Empty(elem)).ok();
216 216
217 // use template qcow2 217 // use template qcow2
218 if is_qcow_elem && self.is_backing { 218 if is_qcow_elem && self.is_backing {
219 writer.write(b"\n").unwrap();
219 let mut backing_store_start = BytesStart::borrowed_name(b"backingStore"); 220 let mut backing_store_start = BytesStart::borrowed_name(b"backingStore");
220 backing_store_start.push_attribute(("type", "file")); 221 backing_store_start.push_attribute(("type", "file"));
221 backing_store_start.push_attribute(("index", "3")); 222 backing_store_start.push_attribute(("index", "3"));
222 writer 223 writer
223 .write_event(Event::Empty(backing_store_start)) 224 .write_event(Event::Start(backing_store_start))
224 .unwrap(); 225 .unwrap();
225 226
226 writer.write(b"\n").unwrap(); 227 writer.write(b"\n").unwrap();
227 228
228 let mut format_elem = BytesStart::borrowed_name(b"format"); 229 let mut format_elem = BytesStart::borrowed_name(b"format");
236 writer.write_event(Event::Empty(backing_sorce)).unwrap(); 237 writer.write_event(Event::Empty(backing_sorce)).unwrap();
237 writer.write(b"\n").unwrap(); 238 writer.write(b"\n").unwrap();
238 239
239 let backing_store_end = BytesEnd::borrowed(b"backingStore"); 240 let backing_store_end = BytesEnd::borrowed(b"backingStore");
240 writer.write_event(Event::End(backing_store_end)).unwrap(); 241 writer.write_event(Event::End(backing_store_end)).unwrap();
241 writer.write(b"\n").unwrap();
242
243 let disk_end = BytesEnd::borrowed(b"disk");
244 writer.write_event(Event::End(disk_end)).unwrap();
245 writer.write(b"\n").unwrap(); 242 writer.write(b"\n").unwrap();
246 } 243 }
247 } 244 }
248 245
249 Ok(Event::Text(ref e)) if e.escaped() == IE_VIRSH_TEMPLATE_VM_NAME.as_bytes() => { 246 Ok(Event::Text(ref e)) if e.escaped() == IE_VIRSH_TEMPLATE_VM_NAME.as_bytes() => {