-
Notifications
You must be signed in to change notification settings - Fork 0
/
undefine.patch
38 lines (35 loc) · 1.45 KB
/
undefine.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
diff --git a/virttest/libvirt_vm.py b/virttest/libvirt_vm.py
index e17e30c..42e66da 100644
--- a/virttest/libvirt_vm.py
+++ b/virttest/libvirt_vm.py
@@ -277,6 +277,7 @@ class VM(virt_vm.BaseVM):
virsh.dumpxml(self.name, extra=extra,
to_file=xml_file, uri=self.connect_uri)
+ utils.run("sed -i '/<nvram>.*<\/nvram>/d' %s" % xml_file)
return xml_file
except Exception, detail:
if os.path.exists(xml_file):
diff --git a/virttest/libvirt_xml/vm_xml.py b/virttest/libvirt_xml/vm_xml.py
index 1a77bc2..76f2c14 100644
--- a/virttest/libvirt_xml/vm_xml.py
+++ b/virttest/libvirt_xml/vm_xml.py
@@ -528,6 +528,8 @@ class VMXML(VMXMLBase):
vmxml = VMXML(virsh_instance=virsh_instance)
vmxml['xml'] = virsh_instance.dumpxml(vm_name,
extra=options).stdout.strip()
+ vmxml.xmltreefile.remove_by_xpath('/os/nvram', remove_all=True)
+ vmxml.xmltreefile.write()
return vmxml
@staticmethod
diff --git a/virttest/virsh.py b/virttest/virsh.py
index 70dc302..5c8a3f5 100644
--- a/virttest/virsh.py
+++ b/virttest/virsh.py
@@ -1310,7 +1310,7 @@ def undefine(name, options=None, **dargs):
:param dargs: standardized virsh function API keywords
:return: CmdResult object
"""
- cmd = "undefine %s" % name
+ cmd = "undefine %s --nvram" % name
if options is not None:
cmd += " %s" % options