From 347b5878d2a358e5bbf25d04f8077f620cc2c6bc Mon Sep 17 00:00:00 2001 From: jbjohnso Date: Thu, 29 Sep 2011 17:58:47 +0000 Subject: [PATCH] Take opportunity of power reset to change virtual clock behavior if applicable git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@10677 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server/lib/xcat/plugins/kvm.pm | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/xCAT-server/lib/xcat/plugins/kvm.pm b/xCAT-server/lib/xcat/plugins/kvm.pm index 9824231c9..eefeeda17 100644 --- a/xCAT-server/lib/xcat/plugins/kvm.pm +++ b/xCAT-server/lib/xcat/plugins/kvm.pm @@ -328,8 +328,25 @@ sub reconfigvm { my $xml = shift; my $domdesc = $parser->parse_string($xml); my @bootdevs = $domdesc->findnodes("/domain/os/boot"); - my @oldbootdevs; + my $curroffset = $domdesc->findnodes("/domain/clock")->[0]->getAttribute("offset"); + my $newoffset; my $needfixin=0; + if (defined ($confdata->{vm}->{$node}->[0]->{clockoffset})) { + #If user requested a specific behavior, give it + $newoffset = $confdata->{vm}->{$node}->[0]->{clockoffset}; + } else { + #Otherwise, only do local time for things that look MS + if (defined ($confdata->{nodetype}->{$node}->[0]->{os}) and $confdata->{nodetype}->{$node}->[0]->{os} =~ /win.*/) { + $newoffset = 'localtime'; + } else { #For everyone else, utc is preferred generally + $newoffset = 'utc'; + } + } + if ($curroffset ne $newoffset) { + $needfixin=1; + $domdesc->findnodes("/domain/clock")->[0]->setAttribute("offset",$newoffset); + } + my @oldbootdevs; if (defined $confdata->{vm}->{$node}->[0]->{memory}) { $needfixin=1; $domdesc->findnodes("/domain/memory/text()")->[0]->setData(getUnits($confdata->{vm}->{$node}->[0]->{memory},"M",1024));