mirror of
https://github.com/microsoft/onefuzz.git
synced 2025-06-14 11:08:06 +00:00
support multiple corpus accounts (#334)
Add support for sharding across multiple storage accounts for blob containers used for corpus management. Things to note: 1. Additional storage accounts must be in the same resource group, support the "blob" endpoint, and have the tag `storage_type` with the value `corpus`. A utility is provided (`src/utils/add-corpus-storage-accounts`), which adds storage accounts. 2. If any secondary storage accounts exist, they are used by default for containers. 3. Storage account names are cached in memory the Azure Function instance forever. Upon adding new storage accounts, the app needs to be restarted to pick up the new accounts.
This commit is contained in:
@ -12,11 +12,13 @@ from onefuzztypes.enums import OS, ContainerType, ErrorCode, VmState
|
||||
from onefuzztypes.models import Error
|
||||
from onefuzztypes.models import Repro as BASE_REPRO
|
||||
from onefuzztypes.models import ReproConfig, TaskVm, UserInfo
|
||||
from onefuzztypes.primitives import Container
|
||||
|
||||
from .azure.auth import build_auth
|
||||
from .azure.containers import StorageType, save_blob
|
||||
from .azure.containers import save_blob
|
||||
from .azure.creds import get_base_region
|
||||
from .azure.ip import get_public_ip
|
||||
from .azure.storage import StorageType
|
||||
from .azure.vm import VM
|
||||
from .extension import repro_extensions
|
||||
from .orm import ORMMixin, QueryFilter
|
||||
@ -98,7 +100,7 @@ class Repro(BASE_REPRO, ORMMixin):
|
||||
)
|
||||
return self.set_error(Error(code=ErrorCode.VM_CREATE_FAILED, errors=errors))
|
||||
|
||||
def get_setup_container(self) -> Optional[str]:
|
||||
def get_setup_container(self) -> Optional[Container]:
|
||||
task = Task.get_by_task_id(self.task_id)
|
||||
if isinstance(task, Task):
|
||||
for container in task.config.containers:
|
||||
@ -202,7 +204,7 @@ class Repro(BASE_REPRO, ORMMixin):
|
||||
|
||||
for filename in files:
|
||||
save_blob(
|
||||
"repro-scripts",
|
||||
Container("repro-scripts"),
|
||||
"%s/%s" % (self.vm_id, filename),
|
||||
files[filename],
|
||||
StorageType.config,
|
||||
|
Reference in New Issue
Block a user