- fix use_compression
This commit is contained in:
		
							parent
							
								
									dc53354ea2
								
							
						
					
					
						commit
						f88c9d1d06
					
				@ -18,17 +18,10 @@
 | 
			
		||||
#
 | 
			
		||||
# -----------------------------------------------------------------------
 | 
			
		||||
from __future__ import with_statement
 | 
			
		||||
import os
 | 
			
		||||
import datetime
 | 
			
		||||
from common import *
 | 
			
		||||
import XenAPI
 | 
			
		||||
import time
 | 
			
		||||
import logging
 | 
			
		||||
import re
 | 
			
		||||
import os.path
 | 
			
		||||
import os
 | 
			
		||||
import datetime
 | 
			
		||||
import select
 | 
			
		||||
import urllib
 | 
			
		||||
import socket
 | 
			
		||||
import tarfile
 | 
			
		||||
@ -36,6 +29,9 @@ import hashlib
 | 
			
		||||
from stat import *
 | 
			
		||||
import ssl
 | 
			
		||||
 | 
			
		||||
from common import *
 | 
			
		||||
import XenAPI
 | 
			
		||||
 | 
			
		||||
if hasattr(ssl, '_create_unverified_context'):
 | 
			
		||||
    ssl._create_default_https_context = ssl._create_unverified_context
 | 
			
		||||
 | 
			
		||||
@ -54,7 +50,7 @@ class backup_xva(backup_generic):
 | 
			
		||||
    ignore_proxies = "yes"
 | 
			
		||||
    use_compression = "true"
 | 
			
		||||
 | 
			
		||||
    if  str2bool(ignore_proxies) == True:
 | 
			
		||||
    if str2bool(ignore_proxies):
 | 
			
		||||
        os.environ['http_proxy']=""
 | 
			
		||||
        os.environ['https_proxy']=""
 | 
			
		||||
 | 
			
		||||
@ -99,7 +95,7 @@ class backup_xva(backup_generic):
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        #add snapshot option
 | 
			
		||||
        if str2bool(halt_vm) == False:
 | 
			
		||||
        if not str2bool(halt_vm):
 | 
			
		||||
            self.logger.debug("[%s] Check if previous tisbackups snapshots exist",vdi_name)
 | 
			
		||||
            old_snapshots =  session.xenapi.VM.get_by_name_label("tisbackup-%s"%(vdi_name))
 | 
			
		||||
            self.logger.debug("[%s] Old snaps count %s", vdi_name, len(old_snapshots))
 | 
			
		||||
@ -146,11 +142,11 @@ class backup_xva(backup_generic):
 | 
			
		||||
            try:
 | 
			
		||||
                filename_temp = filename+".tmp"
 | 
			
		||||
                self.logger.debug("[%s] Copy in progress",self.backup_name)
 | 
			
		||||
                if not str2bool(use_compression):
 | 
			
		||||
                if not str2bool(self.use_compression):
 | 
			
		||||
                    socket.setdefaulttimeout(120)
 | 
			
		||||
 | 
			
		||||
                scheme = "http://"
 | 
			
		||||
                if str2bool(enable_https) == True:
 | 
			
		||||
                if str2bool(enable_https):
 | 
			
		||||
                    scheme = "https://"
 | 
			
		||||
                url = scheme+user_xen+":"+password_xen+"@"+self.xcphost+"/export?use_compression="+self.use_compression+"&uuid="+session.xenapi.VM.get_uuid(vm)
 | 
			
		||||
 | 
			
		||||
@ -164,7 +160,7 @@ class backup_xva(backup_generic):
 | 
			
		||||
                raise
 | 
			
		||||
 | 
			
		||||
        finally:
 | 
			
		||||
            if str2bool(halt_vm) == False:
 | 
			
		||||
            if not str2bool(halt_vm):
 | 
			
		||||
                self.logger.debug("[%s] Destroy snapshot",'tisbackup-%s'%(vdi_name))
 | 
			
		||||
                try:
 | 
			
		||||
                    for vbd in session.xenapi.VM.get_VBDs(snapshot):
 | 
			
		||||
@ -190,7 +186,7 @@ class backup_xva(backup_generic):
 | 
			
		||||
        if os.path.exists(filename_temp):
 | 
			
		||||
            tar = tarfile.open(filename_temp)
 | 
			
		||||
            if not tar.getnames():
 | 
			
		||||
                unlink(filename_temp)
 | 
			
		||||
                os.unlink(filename_temp)
 | 
			
		||||
                return("Tar error")
 | 
			
		||||
            tar.close()
 | 
			
		||||
            if str2bool(self.verify_export):
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user