diff --git a/scripts/vm/hypervisor/xenserver/vmops b/scripts/vm/hypervisor/xenserver/vmops index 9bab8942d57..053f3c86003 100755 --- a/scripts/vm/hypervisor/xenserver/vmops +++ b/scripts/vm/hypervisor/xenserver/vmops @@ -29,6 +29,7 @@ import tempfile VHD_UTIL = '/usr/sbin/vhd-util' VHD_PREFIX = 'VHD-' +CLOUD_DIR = '/var/run/cloud_mount' def echo(fn): def wrapped(*v, **k): @@ -76,7 +77,7 @@ def create_secondary_storage_folder(session, args): try: # Mount the remote resource folder locally remote_mount_path = args["remoteMountPath"] - local_mount_path = os.path.join(SR.MOUNT_BASE, "mount" + str(int(random.random() * 1000000))) + local_mount_path = os.path.join(CLOUD_DIR, "mount" + str(int(random.random() * 1000000))) mount(remote_mount_path, local_mount_path) # Create the new folder @@ -112,7 +113,7 @@ def delete_secondary_storage_folder(session, args): try: # Mount the remote resource folder locally remote_mount_path = args["remoteMountPath"] - local_mount_path = os.path.join(SR.MOUNT_BASE, "mount" + str(int(random.random() * 1000000))) + local_mount_path = os.path.join(CLOUD_DIR, "mount" + str(int(random.random() * 1000000))) mount(remote_mount_path, local_mount_path) # Delete the specified folder @@ -148,7 +149,7 @@ def post_create_private_template(session, args): try: # Mount the remote templates folder locally remote_mount_path = args["remoteTemplateMountPath"] - local_mount_path = os.path.join(SR.MOUNT_BASE, "template" + str(int(random.random() * 10000))) + local_mount_path = os.path.join(CLOUD_DIR, "template" + str(int(random.random() * 10000))) mount(remote_mount_path, local_mount_path) util.SMlog("Mounted secondary storage template folder") @@ -757,7 +758,7 @@ def mountTemplatesDir(secondaryStorageMountPath, templatePath): absoluteTemplateDir = os.path.dirname(absoluteTemplatePath) randomUUID = util.gen_uuid() - localTemplateDir = os.path.join(SR.MOUNT_BASE, randomUUID) + localTemplateDir = os.path.join(CLOUD_DIR, randomUUID) # create the temp dir makedirs(localTemplateDir) # mount @@ -777,7 +778,7 @@ def mountSnapshotsDir(secondaryStorageMountPath, relativeDir, dcId, accountId, i snapshotsDir = os.path.join(secondaryStorageMountPath, relativeDir) # Mkdir local mount point dir, if it doesn't exist. - localMountPointPath = os.path.join(SR.MOUNT_BASE, dcId) + localMountPointPath = os.path.join(CLOUD_DIR, dcId) localMountPointPath = os.path.join(localMountPointPath, relativeDir) makedirs(localMountPointPath) @@ -800,7 +801,7 @@ def mountSnapshotsDir(secondaryStorageMountPath, relativeDir, dcId, accountId, i @echo def unmountSnapshotsDir(session, args): dcId = args['dcId'] - localMountPointPath = os.path.join(SR.MOUNT_BASE, dcId) + localMountPointPath = os.path.join(CLOUD_DIR, dcId) localMountPointPath = os.path.join(localMountPointPath, "snapshots") try: umount(localMountPointPath) @@ -1221,7 +1222,7 @@ def createVolumeFromSnapshot(session, args): if templateDownloadFolder: # Copy all the vhds to the final destination templates dir # It is some random directory on the primary created for templates. - destDirParent = os.path.join(SR.MOUNT_BASE, "mount" + str(int(random.random() * 1000000))) + destDirParent = os.path.join(CLOUD_DIR, "mount" + str(int(random.random() * 1000000))) destDir = os.path.join(destDirParent, templateDownloadFolder) # create the this directory, if it isn't there makedirs(destDir)