Przeglądaj źródła

Add resources/bin directory

Move the static binaries from the `resources` directory
to `resources/bin` directory.

This is useful when running the Coriolis service into a
container, as `resources/bin` can be used as a mount point
with the binaries separately built.
Ionut Balutoiu 6 lat temu
rodzic
commit
24bb4064a1

+ 1 - 1
.gitignore

@@ -38,4 +38,4 @@ nosetests.xml
 nova/tests/cover/*
 nova/vcsversion.py
 tools/conf/nova.conf*
-coriolis/resources/write_data
+coriolis/resources/bin/write_data

+ 2 - 2
coriolis/providers/backup_writers.py

@@ -276,7 +276,7 @@ class SSHBackupWriter(BaseBackupWriter):
         with self._lock:
             sftp = ssh.open_sftp()
             local_path = os.path.join(
-                utils.get_resources_dir(), 'write_data')
+                utils.get_resources_bin_dir(), 'write_data')
             try:
                 # Check if the remote file already exists
                 sftp.stat('write_data')
@@ -577,7 +577,7 @@ class HTTPBackupWriter(BaseBackupWriter):
     @utils.retry_on_error()
     def _copy_writer(self, ssh):
         local_path = os.path.join(
-            utils.get_resources_dir(), _CORIOLIS_HTTP_WRITER_CMD)
+            utils.get_resources_bin_dir(), _CORIOLIS_HTTP_WRITER_CMD)
         remote_tmp_path = os.path.join("/tmp", _CORIOLIS_HTTP_WRITER_CMD)
         with self._lock:
             sftp = ssh.open_sftp()

+ 1 - 1
coriolis/providers/replicator.py

@@ -390,7 +390,7 @@ class Replicator(object):
     @utils.retry_on_error()
     def _copy_replicator_cmd(self, ssh):
         local_path = os.path.join(
-            utils.get_resources_dir(), 'replicator')
+            utils.get_resources_bin_dir(), 'replicator')
         self._copy_file(ssh, local_path, REPLICATOR_PATH)
         utils.exec_ssh_cmd(
             ssh, "sudo chmod +x %s" % REPLICATOR_PATH, get_pty=True)

+ 0 - 0
coriolis/resources/coriolis-writer → coriolis/resources/bin/coriolis-writer


+ 0 - 0
coriolis/resources/replicator → coriolis/resources/bin/replicator


+ 1 - 1
coriolis/resources/makefile

@@ -1,3 +1,3 @@
 write_data: write_data.c
-	gcc -o write_data write_data.c -lz
+	gcc -o bin/write_data write_data.c -lz
 

+ 4 - 0
coriolis/utils.py

@@ -365,6 +365,10 @@ def get_resources_dir():
         os.path.dirname(os.path.abspath(__file__)), "resources")
 
 
+def get_resources_bin_dir():
+    return os.path.join(get_resources_dir(), "bin")
+
+
 def serialize_key(key, password=None):
     key_io = io.StringIO()
     key.write_private_key(key_io, password)