Skip to content

Commit

Permalink
Only run Confidentifial if is_confidential
Browse files Browse the repository at this point in the history
  • Loading branch information
olethanh committed Jun 14, 2024
1 parent 8641539 commit 15d7565
Showing 1 changed file with 21 additions and 9 deletions.
30 changes: 21 additions & 9 deletions src/aleph/vm/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
from aleph.vm.controllers.qemu.instance import AlephQemuInstance, AlephQemuResources
from aleph.vm.controllers.qemu_confidential.instance import (
AlephQemuConfidentialInstance,
AlephQemuConfidentialResources,
)
from aleph.vm.network.interfaces import TapInterface
from aleph.vm.orchestrator.metrics import (
Expand Down Expand Up @@ -238,15 +239,26 @@ def create(
prepare_jailer=prepare,
)
elif self.hypervisor == HypervisorType.qemu:
assert isinstance(self.resources, AlephQemuResources)
self.vm = vm = AlephQemuConfidentialInstance(
vm_id=vm_id,
vm_hash=self.vm_hash,
resources=self.resources,
enable_networking=self.message.environment.internet,
hardware_resources=self.message.resources,
tap_interface=tap_interface,
)
if self.is_confidential:
assert isinstance(self.resources, AlephQemuConfidentialResources)
self.vm = vm = AlephQemuConfidentialInstance(
vm_id=vm_id,
vm_hash=self.vm_hash,
resources=self.resources,
enable_networking=self.message.environment.internet,
hardware_resources=self.message.resources,
tap_interface=tap_interface,
)
else:
assert isinstance(self.resources, AlephQemuResources)
self.vm = vm = AlephQemuInstance(
vm_id=vm_id,
vm_hash=self.vm_hash,
resources=self.resources,
enable_networking=self.message.environment.internet,
hardware_resources=self.message.resources,
tap_interface=tap_interface,
)
else:
raise Exception("Unknown VM")
else:
Expand Down

0 comments on commit 15d7565

Please sign in to comment.