-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial integration with Oxide Packet Transformation Engine
- Brings in OPTE via the `opte-ioctl` and `opte` crates. - Modifies the instance-ensure request from Nexus to the sled agent, to carry the actual information required for setting up the guest OPTE port. This includes the actual IP subnet and MAC, rather than things like the VPC Subnet UUID. - Adds a database query and method to extract the above information from both the network interface and VPC subnet tables. - Adds OPTE port for the guests (and currently still a VNIC on top), with the right OPTE settings for traffic to flow between two guests in the same VPC subnet. That's the virtual-to-physical mapping and a router entry for the subnet. - Adds the VNICs over each OPTE port to the running zone. Note that this removes the specification of guest NICs for the zone itself as VNICs. They are passed as OPTE ports, and the VNIC is pulled out internally, so hopefully little will need to change when the VNIC is removed entirely. - Store the main underlay address for the sled agent, currently its dropshot server IP address, in the instance manager, and forward to each instance. It's then used as the underlay address when setting up the OPTE ports for the guest. Addressing review comments Add a unique VNI to each VPC Updating OPTE dependency and package repos Add dummy/mock module for OPTE on non-illumos systems
- Loading branch information
Showing
27 changed files
with
1,635 additions
and
359 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
// This Source Code Form is subject to the terms of the Mozilla Public | ||
// License, v. 2.0. If a copy of the MPL was not distributed with this | ||
// file, You can obtain one at https://mozilla.org/MPL/2.0/. | ||
|
||
use omicron_common::api::external; | ||
use diesel::sql_types; | ||
use diesel::serialize; | ||
use diesel::deserialize; | ||
use diesel::serialize::ToSql; | ||
use diesel::deserialize::FromSql; | ||
use diesel::backend::RawValue; | ||
use diesel::backend::Backend; | ||
use diesel::query_builder::bind_collector::RawBytesBindCollector; | ||
|
||
#[derive(Clone, Debug, Copy, AsExpression, FromSqlRow)] | ||
#[diesel(sql_type = sql_types::Int4)] | ||
pub struct Vni(pub external::Vni); | ||
|
||
impl<DB> ToSql<sql_types::Int4, DB> for Vni | ||
where | ||
DB: Backend<BindCollector = RawBytesBindCollector<DB>>, | ||
i32: ToSql<sql_types::Int4, DB>, | ||
{ | ||
fn to_sql<'b>( | ||
&'b self, | ||
out: &mut serialize::Output<'b, '_, DB>, | ||
) -> serialize::Result { | ||
// Reborrowing is necessary to ensure that the lifetime of the temporary | ||
// i32 created here and `out` is the same, i.e., that `'b = '_`. | ||
i32::try_from(u32::from(self.0)).unwrap().to_sql(&mut out.reborrow()) | ||
} | ||
} | ||
|
||
impl<DB> FromSql<sql_types::Int4, DB> for Vni | ||
where | ||
DB: Backend, | ||
i32: FromSql<sql_types::Int4, DB>, | ||
{ | ||
fn from_sql(bytes: RawValue<DB>) -> deserialize::Result<Self> { | ||
Ok(Vni(external::Vni::try_from(i32::from_sql(bytes)?)?)) | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.