Skip to content

Commit

Permalink
Allow root disk as runner-storage
Browse files Browse the repository at this point in the history
  • Loading branch information
yhaliaw committed Jan 29, 2024
1 parent ae2a5cc commit 88d5765
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 19 deletions.
1 change: 0 additions & 1 deletion docs/how-to/configure-runner-storage.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,3 @@ juju deploy github-runner --constraints="cores=4 mem=6G root-disk=30G virt-type=
```

The above example uses `rootfs`, which is using the root disk of the juju machine. Hence the root-disk size was increase to 30G.
In production environment, a separated storage managed by juju should be used. See [how to manage juju storage](https://juju.is/docs/juju/manage-storage).
18 changes: 0 additions & 18 deletions src/charm.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,16 +232,6 @@ def _create_memory_storage(self, path: Path, size: int) -> None:
logger.info("Cleaned up storage directory")
raise RunnerError("Failed to configure runner storage") from err

def _juju_storage_mounted(self) -> bool:
"""Whether a juju storage is mounted on the runner-storage location.
Returns:
True if a juju storage is mounted on the runner-storage location.
"""
# Use `mount` as Python does not have easy method to get the mount points.
stdout, exit_code = execute_command(["mountpoint", str(self.juju_storage_path)], False)
return exit_code == 0 and str(self.juju_storage_path) in stdout

@retry(tries=5, delay=15, max_delay=60, backoff=1.5, local_logger=logger)
def _ensure_runner_storage(self, size: int) -> Path:
"""Ensure the runner storage is setup.
Expand All @@ -258,15 +248,7 @@ def _ensure_runner_storage(self, size: int) -> Path:
path = self.ram_pool_path
self._create_memory_storage(self.ram_pool_path, size)
case RunnerStorage.JUJU_STORAGE:
logger.info("Verifying juju storage")
path = self.juju_storage_path
if not self._juju_storage_mounted():
raise ConfigurationError(
(
"Non-root disk storage should be mount on the runner juju storage to "
"be used as the disk for the runners"
)
)

# tmpfs storage is not created if required size is 0.
if size > 0:
Expand Down

0 comments on commit 88d5765

Please sign in to comment.