tighten plasmavmc vm and volume id validation
This commit is contained in:
parent
0745216107
commit
105dccfaa9
1 changed files with 16 additions and 1 deletions
|
|
@ -2473,6 +2473,7 @@ impl VmService for VmServiceImpl {
|
||||||
let mut req = request.into_inner();
|
let mut req = request.into_inner();
|
||||||
req.org_id = org_id;
|
req.org_id = org_id;
|
||||||
req.project_id = project_id;
|
req.project_id = project_id;
|
||||||
|
Self::require_uuid(&req.vm_id, "vm_id")?;
|
||||||
tracing::info!(
|
tracing::info!(
|
||||||
vm_id = %req.vm_id,
|
vm_id = %req.vm_id,
|
||||||
org_id = %req.org_id,
|
org_id = %req.org_id,
|
||||||
|
|
@ -2595,6 +2596,7 @@ impl VmService for VmServiceImpl {
|
||||||
let mut req = request.into_inner();
|
let mut req = request.into_inner();
|
||||||
req.org_id = org_id;
|
req.org_id = org_id;
|
||||||
req.project_id = project_id;
|
req.project_id = project_id;
|
||||||
|
Self::require_uuid(&req.vm_id, "vm_id")?;
|
||||||
tracing::info!(
|
tracing::info!(
|
||||||
vm_id = %req.vm_id,
|
vm_id = %req.vm_id,
|
||||||
org_id = %req.org_id,
|
org_id = %req.org_id,
|
||||||
|
|
@ -2619,7 +2621,9 @@ impl VmService for VmServiceImpl {
|
||||||
|
|
||||||
// Update spec if provided
|
// Update spec if provided
|
||||||
if req.spec.is_some() {
|
if req.spec.is_some() {
|
||||||
vm.spec = Self::proto_spec_to_types(req.spec);
|
let updated_spec = Self::proto_spec_to_types(req.spec);
|
||||||
|
Self::validate_vm_disk_references(&updated_spec)?;
|
||||||
|
vm.spec = updated_spec;
|
||||||
tracing::info!(
|
tracing::info!(
|
||||||
vm_id = %req.vm_id,
|
vm_id = %req.vm_id,
|
||||||
vcpus = vm.spec.cpu.vcpus,
|
vcpus = vm.spec.cpu.vcpus,
|
||||||
|
|
@ -2672,6 +2676,7 @@ impl VmService for VmServiceImpl {
|
||||||
let mut req = request.into_inner();
|
let mut req = request.into_inner();
|
||||||
req.org_id = org_id;
|
req.org_id = org_id;
|
||||||
req.project_id = project_id;
|
req.project_id = project_id;
|
||||||
|
Self::require_uuid(&req.vm_id, "vm_id")?;
|
||||||
tracing::info!(
|
tracing::info!(
|
||||||
vm_id = %req.vm_id,
|
vm_id = %req.vm_id,
|
||||||
org_id = %req.org_id,
|
org_id = %req.org_id,
|
||||||
|
|
@ -2779,6 +2784,7 @@ impl VmService for VmServiceImpl {
|
||||||
let mut req = request.into_inner();
|
let mut req = request.into_inner();
|
||||||
req.org_id = org_id;
|
req.org_id = org_id;
|
||||||
req.project_id = project_id;
|
req.project_id = project_id;
|
||||||
|
Self::require_uuid(&req.vm_id, "vm_id")?;
|
||||||
tracing::info!(
|
tracing::info!(
|
||||||
vm_id = %req.vm_id,
|
vm_id = %req.vm_id,
|
||||||
org_id = %req.org_id,
|
org_id = %req.org_id,
|
||||||
|
|
@ -2878,6 +2884,7 @@ impl VmService for VmServiceImpl {
|
||||||
let mut req = request.into_inner();
|
let mut req = request.into_inner();
|
||||||
req.org_id = org_id;
|
req.org_id = org_id;
|
||||||
req.project_id = project_id;
|
req.project_id = project_id;
|
||||||
|
Self::require_uuid(&req.vm_id, "vm_id")?;
|
||||||
tracing::info!(
|
tracing::info!(
|
||||||
vm_id = %req.vm_id,
|
vm_id = %req.vm_id,
|
||||||
org_id = %req.org_id,
|
org_id = %req.org_id,
|
||||||
|
|
@ -2968,6 +2975,7 @@ impl VmService for VmServiceImpl {
|
||||||
let mut req = request.into_inner();
|
let mut req = request.into_inner();
|
||||||
req.org_id = org_id;
|
req.org_id = org_id;
|
||||||
req.project_id = project_id;
|
req.project_id = project_id;
|
||||||
|
Self::require_uuid(&req.vm_id, "vm_id")?;
|
||||||
tracing::info!(
|
tracing::info!(
|
||||||
vm_id = %req.vm_id,
|
vm_id = %req.vm_id,
|
||||||
org_id = %req.org_id,
|
org_id = %req.org_id,
|
||||||
|
|
@ -3049,6 +3057,7 @@ impl VmService for VmServiceImpl {
|
||||||
let mut req = request.into_inner();
|
let mut req = request.into_inner();
|
||||||
req.org_id = org_id;
|
req.org_id = org_id;
|
||||||
req.project_id = project_id;
|
req.project_id = project_id;
|
||||||
|
Self::require_uuid(&req.vm_id, "vm_id")?;
|
||||||
tracing::info!(
|
tracing::info!(
|
||||||
vm_id = %req.vm_id,
|
vm_id = %req.vm_id,
|
||||||
org_id = %req.org_id,
|
org_id = %req.org_id,
|
||||||
|
|
@ -3132,6 +3141,7 @@ impl VmService for VmServiceImpl {
|
||||||
let mut req = request.into_inner();
|
let mut req = request.into_inner();
|
||||||
req.org_id = org_id;
|
req.org_id = org_id;
|
||||||
req.project_id = project_id;
|
req.project_id = project_id;
|
||||||
|
Self::require_uuid(&req.vm_id, "vm_id")?;
|
||||||
tracing::info!(
|
tracing::info!(
|
||||||
vm_id = %req.vm_id,
|
vm_id = %req.vm_id,
|
||||||
org_id = %req.org_id,
|
org_id = %req.org_id,
|
||||||
|
|
@ -3478,6 +3488,7 @@ impl VmService for VmServiceImpl {
|
||||||
let mut req = request.into_inner();
|
let mut req = request.into_inner();
|
||||||
req.org_id = org_id;
|
req.org_id = org_id;
|
||||||
req.project_id = project_id;
|
req.project_id = project_id;
|
||||||
|
Self::require_uuid(&req.vm_id, "vm_id")?;
|
||||||
tracing::info!(
|
tracing::info!(
|
||||||
vm_id = %req.vm_id,
|
vm_id = %req.vm_id,
|
||||||
org_id = %req.org_id,
|
org_id = %req.org_id,
|
||||||
|
|
@ -3675,6 +3686,7 @@ impl VmService for VmServiceImpl {
|
||||||
let mut req = request.into_inner();
|
let mut req = request.into_inner();
|
||||||
req.org_id = org_id;
|
req.org_id = org_id;
|
||||||
req.project_id = project_id;
|
req.project_id = project_id;
|
||||||
|
Self::require_uuid(&req.vm_id, "vm_id")?;
|
||||||
tracing::info!(
|
tracing::info!(
|
||||||
vm_id = %req.vm_id,
|
vm_id = %req.vm_id,
|
||||||
org_id = %req.org_id,
|
org_id = %req.org_id,
|
||||||
|
|
@ -3765,6 +3777,7 @@ impl VmService for VmServiceImpl {
|
||||||
let mut req = request.into_inner();
|
let mut req = request.into_inner();
|
||||||
req.org_id = org_id;
|
req.org_id = org_id;
|
||||||
req.project_id = project_id;
|
req.project_id = project_id;
|
||||||
|
Self::require_uuid(&req.vm_id, "vm_id")?;
|
||||||
tracing::info!(
|
tracing::info!(
|
||||||
vm_id = %req.vm_id,
|
vm_id = %req.vm_id,
|
||||||
org_id = %req.org_id,
|
org_id = %req.org_id,
|
||||||
|
|
@ -3843,6 +3856,7 @@ impl VmService for VmServiceImpl {
|
||||||
let mut req = request.into_inner();
|
let mut req = request.into_inner();
|
||||||
req.org_id = org_id;
|
req.org_id = org_id;
|
||||||
req.project_id = project_id;
|
req.project_id = project_id;
|
||||||
|
Self::require_uuid(&req.vm_id, "vm_id")?;
|
||||||
tracing::info!(
|
tracing::info!(
|
||||||
vm_id = %req.vm_id,
|
vm_id = %req.vm_id,
|
||||||
org_id = %req.org_id,
|
org_id = %req.org_id,
|
||||||
|
|
@ -3907,6 +3921,7 @@ impl VmService for VmServiceImpl {
|
||||||
let mut req = request.into_inner();
|
let mut req = request.into_inner();
|
||||||
req.org_id = org_id;
|
req.org_id = org_id;
|
||||||
req.project_id = project_id;
|
req.project_id = project_id;
|
||||||
|
Self::require_uuid(&req.vm_id, "vm_id")?;
|
||||||
tracing::info!(
|
tracing::info!(
|
||||||
vm_id = %req.vm_id,
|
vm_id = %req.vm_id,
|
||||||
org_id = %req.org_id,
|
org_id = %req.org_id,
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue