From c65badf38672836595a8ddc7a2ff4ce305f9fec9 Mon Sep 17 00:00:00 2001 From: phamt Date: Fri, 3 Dec 2010 21:28:43 +0000 Subject: [PATCH] Created cache directory if there is none, and changed cache directory path. git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@8315 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- perl-xCAT/xCAT/zvmUtils.pm | 10 ++++++++-- xCAT-server/lib/xcat/plugins/zvm.pm | 8 +++++++- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/perl-xCAT/xCAT/zvmUtils.pm b/perl-xCAT/xCAT/zvmUtils.pm index 7c0c163a5..14df715cc 100644 --- a/perl-xCAT/xCAT/zvmUtils.pm +++ b/perl-xCAT/xCAT/zvmUtils.pm @@ -1014,14 +1014,20 @@ sub getUserProfile { # Set directory where executables are on zHCP my $hcpDir = "/opt/zhcp/bin"; + my $out; + # Set directory for cache - my $cache = '/var/opt/zhcp/.vmapi/.cache'; + my $cache = '/var/opt/zhcp/cache'; + # If the cache directory does not exist + if (!(`ssh $hcp "test -d $cache && echo Exists"`)) { + # Create cache directory + $out = `ssh $hcp "mkdir -p $cache"`; + } # Set output file name my $file = "$cache/$profile.profile"; # If a cache for the user profile exists - my $out; if (`ssh $hcp "ls $file"`) { # Get current Epoch diff --git a/xCAT-server/lib/xcat/plugins/zvm.pm b/xCAT-server/lib/xcat/plugins/zvm.pm index e7a2822a3..66b22206a 100644 --- a/xCAT-server/lib/xcat/plugins/zvm.pm +++ b/xCAT-server/lib/xcat/plugins/zvm.pm @@ -1488,7 +1488,7 @@ sub listVM { my ( $callback, $node, $args ) = @_; # Set cache directory - my $cache = '/var/opt/zhcp/.vmapi/.cache'; + my $cache = '/var/opt/zhcp/cache'; # Get node properties from 'zvm' table my @propNames = ( 'hcp', 'userid' ); @@ -1512,6 +1512,12 @@ sub listVM { # Get disk pool names if ( $args->[0] eq "--diskpoolnames" ) { + # If the cache directory does not exist + if (!(`ssh $hcp "test -d $cache && echo Exists"`)) { + # Create cache directory + $out = `ssh $hcp "mkdir -p $cache"`; + } + my $file = "$cache/diskpoolnames"; # If a cache for disk pool names exists