Skip to content
This repository has been archived by the owner on Aug 13, 2019. It is now read-only.

Commit

Permalink
Search for helper scripts in /usr/lib/xcp/bin as well as /opt/xensour…
Browse files Browse the repository at this point in the history
…ce/bin
  • Loading branch information
jamesbulpin authored and andyhhp committed Jan 24, 2014
1 parent c07a431 commit 422cbf1
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
8 changes: 8 additions & 0 deletions XSConsoleConfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ def __init__(self):
for path in ["/usr/bin/xe", "/opt/xensource/bin/xe"]:
if os.path.exists(path):
self.xecli = path

self.helperdir = ''
for path in ["/usr/lib/xcp/bin", "/opt/xensource/bin"]:
if os.path.exists(path):
self.helperdir = path
break

@classmethod
Expand Down Expand Up @@ -84,6 +89,9 @@ def XCPConfigDir(self):
def XECLIPath(self):
return self.xecli

def HelperPath(self):
return self.helperdir

# Import a more specific configuration if available
if os.path.isfile(sys.path[0]+'/XSConsoleConfigOEM.py'):
import XSConsoleConfigOEM
Expand Down
4 changes: 2 additions & 2 deletions plugins-base/XSFeatureDRBackup.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def DoAction(self, inSR):
try:
# determine if there is a backup VDI or not, and if not just create one
sr_uuid = inSR['uuid']
command = "/opt/xensource/bin/xe-backup-metadata -n -u " + sr_uuid
command = "%s/xe-backup-metadata -n -u %s" % (Config.Inst().HelperPath(), sr_uuid)

status, output = commands.getstatusoutput(command)
status = os.WEXITSTATUS(status)
Expand All @@ -45,7 +45,7 @@ def DoAction(self, inSR):
raise Exception(output)

Layout.Inst().TransientBanner(Lang("Backing up metadata... This may take several minutes."))
command = "/opt/xensource/bin/xe-backup-metadata " + initalize_vdi + " -u " + sr_uuid
command = "%s/xe-backup-metadata %s -u %s" % (Config.Inst().HelperPath(), initalize_vdi, sr_uuid)
status, output = commands.getstatusoutput(command)
if status == 0:
Layout.Inst().PushDialogue(InfoDialogue(Lang("Backup Successful"), output))
Expand Down
6 changes: 3 additions & 3 deletions plugins-base/XSFeatureDRRestore.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def HandleMethodChoice(self, inChoice, dryRun):
else:
dry_flag=""
Layout.Inst().TransientBanner(Lang("Restoring VM Metadata. This may take a few minutes..."))
command = "/opt/xensource/bin/xe-restore-metadata -y " + dry_flag +" -u " + self.sr_uuid + " -x " + self.vdi_uuid + " -d " + self.chosen_date + " -m " + chosen_mode
command = "%s/xe-restore-metadata -y %s -u %s -x %s -d %s -m %s" % (Config.Inst().HelperPath(), dry_flag, self.sr_uuid, self.vdi_uuid, self.chosen_date, chosen_mode)
status, output = commands.getstatusoutput(command)
status = os.WEXITSTATUS(status)
Layout.Inst().PopDialogue()
Expand Down Expand Up @@ -143,7 +143,7 @@ def DoAction(self, inSR):
sr_uuid = inSR['uuid']
try:
# probe for the restore VDI UUID
command = "/opt/xensource/bin/xe-restore-metadata -p -u " + sr_uuid
command = "%s/xe-restore-metadata -p -u %s" % (Config.Inst().HelperPath(), sr_uuid)
cmd = subprocess.Popen(command,
stdout = subprocess.PIPE,
stderr = subprocess.PIPE,
Expand All @@ -159,7 +159,7 @@ def DoAction(self, inSR):

# list the available backups
Layout.Inst().TransientBanner(Lang("Found VDI, retrieving available backups..."))
command = "/opt/xensource/bin/xe-restore-metadata -l -u " + sr_uuid + " -x " + vdi_uuid
command = "%s/xe-restore-metadata -l -u %s -x %s" % (Config.Inst().HelperPath(), sr_uuid, vdi_uuid)
cmd = subprocess.Popen(command,
stdout = subprocess.PIPE,
stderr = subprocess.PIPE,
Expand Down

0 comments on commit 422cbf1

Please sign in to comment.