diff --git a/tests/xmlparse-xml/change-guest-in.xml b/tests/xmlparse-xml/change-guest-in.xml index e5bac015d..0514dcce4 100644 --- a/tests/xmlparse-xml/change-guest-in.xml +++ b/tests/xmlparse-xml/change-guest-in.xml @@ -26,7 +26,10 @@ - + + + + destroy restart restart diff --git a/tests/xmlparse-xml/change-guest-out.xml b/tests/xmlparse-xml/change-guest-out.xml index 3e1772e93..a8d225d79 100644 --- a/tests/xmlparse-xml/change-guest-out.xml +++ b/tests/xmlparse-xml/change-guest-out.xml @@ -30,7 +30,10 @@ - + + + + restart destroy destroy diff --git a/tests/xmlparse.py b/tests/xmlparse.py index fdff0e56e..1dd61a6a7 100644 --- a/tests/xmlparse.py +++ b/tests/xmlparse.py @@ -123,6 +123,14 @@ class XMLParseTest(unittest.TestCase): check = self._make_checker(guest.clock) check("offset", "utc", "localtime") + guest.clock.remove_timer(guest.clock.timers[0]) + check = self._make_checker(guest.clock.timers[0]) + check("name", "pit", "rtc") + check("tickpolicy", "delay", "merge") + timer = guest.clock.add_timer() + check = self._make_checker(timer) + check("name", None, "hpet") + check("present", None, False) check = self._make_checker(guest.seclabel) check("type", "static", "static") diff --git a/virtinst/clock.py b/virtinst/clock.py index 8b4065829..eb4ae30bf 100644 --- a/virtinst/clock.py +++ b/virtinst/clock.py @@ -17,10 +17,26 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, # MA 02110-1301 USA. -from virtinst.xmlbuilder import XMLBuilder, XMLProperty +from virtinst.xmlbuilder import XMLBuilder, XMLChildProperty, XMLProperty + + +class _ClockTimer(XMLBuilder): + _XML_ROOT_NAME = "timer" + + name = XMLProperty("./@name") + present = XMLProperty("./@present", is_yesno=True) + tickpolicy = XMLProperty("./@tickpolicy") class Clock(XMLBuilder): _XML_ROOT_NAME = "clock" offset = XMLProperty("./@offset") + timers = XMLChildProperty(_ClockTimer) + + def add_timer(self): + obj = _ClockTimer(self.conn) + self._add_child(obj) + return obj + def remove_timer(self, obj): + self._remove_child(obj)