Skip to content

Commit

Permalink
Merge commit 'f7f3ff7622e0458a3a9a246a54e4673fd92fc1a8' into authz-vpc
Browse files Browse the repository at this point in the history
  • Loading branch information
davepacheco committed Mar 16, 2022
2 parents 41696fa + f7f3ff7 commit 4648edd
Show file tree
Hide file tree
Showing 36 changed files with 1,325 additions and 1,328 deletions.
493 changes: 0 additions & 493 deletions Cargo.lock

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion common/src/api/internal/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,3 @@
//! Internally facing APIs.
pub mod nexus;
pub mod sled_agent;
177 changes: 0 additions & 177 deletions common/src/api/internal/sled_agent.rs

This file was deleted.

29 changes: 29 additions & 0 deletions common/src/sql/dbinit.sql
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,35 @@ CREATE INDEX ON omicron.public.disk (
time_deleted IS NULL AND attach_instance_id IS NOT NULL;


CREATE TABLE omicron.public.snapshot (
/* Identity metadata (resource) */
id UUID PRIMARY KEY,
name STRING(63) NOT NULL,
description STRING(512) NOT NULL,
time_created TIMESTAMPTZ NOT NULL,
time_modified TIMESTAMPTZ NOT NULL,
/* Indicates that the object has been deleted */
time_deleted TIMESTAMPTZ,

/* Every Snapshot is in exactly one Project at a time. */
project_id UUID NOT NULL,

/* Every Snapshot originated from a single disk */
disk_id UUID NOT NULL,

/* Every Snapshot consists of a root volume */
volume_id UUID NOT NULL,

/* Disk configuration (from the time the snapshot was taken) */
size_bytes INT NOT NULL
);

CREATE UNIQUE INDEX ON omicron.public.snapshot (
project_id,
name
) WHERE
time_deleted IS NULL;

/*
* Oximeter collector servers.
*/
Expand Down
111 changes: 19 additions & 92 deletions nexus-client/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
* from within the control plane
*/

use std::convert::TryFrom;

use omicron_common::generate_logging_api;

generate_logging_api!("../openapi/nexus-internal.json");
Expand All @@ -19,12 +17,6 @@ impl omicron_common::api::external::ClientError for types::Error {
}
}

impl From<types::Generation> for omicron_common::api::external::Generation {
fn from(s: types::Generation) -> Self {
Self::try_from(s.0 as i64).unwrap()
}
}

impl From<omicron_common::api::external::ByteCount> for types::ByteCount {
fn from(s: omicron_common::api::external::ByteCount) -> Self {
Self(s.to_bytes())
Expand Down Expand Up @@ -64,19 +56,6 @@ impl From<types::InstanceState>
}
}

impl From<omicron_common::api::internal::sled_agent::DatasetKind>
for types::DatasetKind
{
fn from(d: omicron_common::api::internal::sled_agent::DatasetKind) -> Self {
use omicron_common::api::internal::sled_agent::DatasetKind::*;
match d {
CockroachDb { .. } => types::DatasetKind::Cockroach,
Crucible { .. } => types::DatasetKind::Crucible,
Clickhouse { .. } => types::DatasetKind::Clickhouse,
}
}
}

impl From<omicron_common::api::internal::nexus::InstanceRuntimeState>
for types::InstanceRuntimeState
{
Expand All @@ -99,63 +78,22 @@ impl From<omicron_common::api::internal::nexus::InstanceRuntimeState>
}
}

impl From<&omicron_common::api::internal::nexus::InstanceRuntimeState>
for types::InstanceRuntimeState
{
fn from(
s: &omicron_common::api::internal::nexus::InstanceRuntimeState,
) -> Self {
Self {
run_state: s.run_state.into(),
sled_uuid: s.sled_uuid,
propolis_uuid: s.propolis_uuid,
dst_propolis_uuid: s.dst_propolis_uuid,
propolis_addr: s.propolis_addr.map(|addr| addr.to_string()),
migration_uuid: s.migration_uuid,
ncpus: s.ncpus.into(),
memory: s.memory.into(),
hostname: s.hostname.clone(),
gen: s.gen.into(),
time_updated: s.time_updated,
}
}
}

impl From<omicron_common::api::external::InstanceState>
for types::InstanceState
{
fn from(s: omicron_common::api::external::InstanceState) -> Self {
use omicron_common::api::external::InstanceState;
match s {
omicron_common::api::external::InstanceState::Creating => {
Self::Creating
}
omicron_common::api::external::InstanceState::Starting => {
Self::Starting
}
omicron_common::api::external::InstanceState::Running => {
Self::Running
}
omicron_common::api::external::InstanceState::Stopping => {
Self::Stopping
}
omicron_common::api::external::InstanceState::Stopped => {
Self::Stopped
}
omicron_common::api::external::InstanceState::Rebooting => {
Self::Rebooting
}
omicron_common::api::external::InstanceState::Migrating => {
Self::Migrating
}
omicron_common::api::external::InstanceState::Repairing => {
Self::Repairing
}
omicron_common::api::external::InstanceState::Failed => {
Self::Failed
}
omicron_common::api::external::InstanceState::Destroyed => {
Self::Destroyed
}
InstanceState::Creating => Self::Creating,
InstanceState::Starting => Self::Starting,
InstanceState::Running => Self::Running,
InstanceState::Stopping => Self::Stopping,
InstanceState::Stopped => Self::Stopped,
InstanceState::Rebooting => Self::Rebooting,
InstanceState::Migrating => Self::Migrating,
InstanceState::Repairing => Self::Repairing,
InstanceState::Failed => Self::Failed,
InstanceState::Destroyed => Self::Destroyed,
}
}
}
Expand Down Expand Up @@ -188,26 +126,15 @@ impl From<omicron_common::api::internal::nexus::DiskRuntimeState>

impl From<omicron_common::api::external::DiskState> for types::DiskState {
fn from(s: omicron_common::api::external::DiskState) -> Self {
use omicron_common::api::external::DiskState;
match s {
omicron_common::api::external::DiskState::Creating => {
Self::Creating
}
omicron_common::api::external::DiskState::Detached => {
Self::Detached
}
omicron_common::api::external::DiskState::Attaching(u) => {
Self::Attaching(u)
}
omicron_common::api::external::DiskState::Attached(u) => {
Self::Attached(u)
}
omicron_common::api::external::DiskState::Detaching(u) => {
Self::Detaching(u)
}
omicron_common::api::external::DiskState::Destroyed => {
Self::Destroyed
}
omicron_common::api::external::DiskState::Faulted => Self::Faulted,
DiskState::Creating => Self::Creating,
DiskState::Detached => Self::Detached,
DiskState::Attaching(u) => Self::Attaching(u),
DiskState::Attached(u) => Self::Attached(u),
DiskState::Detaching(u) => Self::Detaching(u),
DiskState::Destroyed => Self::Destroyed,
DiskState::Faulted => Self::Faulted,
}
}
}
Expand Down
Loading

0 comments on commit 4648edd

Please sign in to comment.