syntheses:vps-create-flow
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| syntheses:vps-create-flow [17/07/2026 03:15] – external edit 127.0.0.1 | syntheses:vps-create-flow [03/08/2026 23:16] (current) – removed - external edit (Unknown date) 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ====== VPS Creation / Provisioning Flow ====== | ||
| - | |||
| - | This page traces the source-backed flow for creating a VPS from the customer/ | ||
| - | |||
| - | ===== Scope ===== | ||
| - | |||
| - | * Main repo: '' | ||
| - | * Main application area: '' | ||
| - | * Compute execution: HostDaemon and host command handlers | ||
| - | * Related repo: '' | ||
| - | |||
| - | ===== Short Version ===== | ||
| - | |||
| - | - The API accepts a create-server request and validates the customer, plan, OS, network, billing state, and requested options. | ||
| - | - Domain services create a '' | ||
| - | - Provisioning services assign the lease, host, network, primary interface/ | ||
| - | - '' | ||
| - | - HostDaemon polls the '' | ||
| - | - On success, HostDaemon sets the guest status to '' | ||
| - | - On failure, HostDaemon attempts cleanup/ | ||
| - | |||
| - | ===== API and Domain Flow ===== | ||
| - | |||
| - | ==== 1. API request ==== | ||
| - | |||
| - | '' | ||
| - | |||
| - | '' | ||
| - | |||
| - | * fetches the customer via '' | ||
| - | * checks '' | ||
| - | * validates purchase eligibility, | ||
| - | * resolves creation parameters such as facility, plan, operating system, network, and extras; | ||
| - | * creates the guest/ | ||
| - | * flushes NHibernate so the API ID exists; | ||
| - | * attempts immediate invoice processing when the blocking invoice requires payment; | ||
| - | * returns an action DTO for the created host command. | ||
| - | |||
| - | Relevant source notes: | ||
| - | |||
| - | * '' | ||
| - | * If '' | ||
| - | |||
| - | ==== 2. Guest/ | ||
| - | |||
| - | '' | ||
| - | |||
| - | '' | ||
| - | |||
| - | * repeats purchase and guest-limit checks at domain level; | ||
| - | * validates private IP/VPC details; | ||
| - | * creates the guest entity through '' | ||
| - | * validates the guest; | ||
| - | * applies options such as port blocks, IPv6, split NICs, SSH keys, script/ | ||
| - | * calls '' | ||
| - | * commits the guest; | ||
| - | * handles referral/ | ||
| - | * queues the host command through '' | ||
| - | |||
| - | ==== 3. Initial guest state ==== | ||
| - | |||
| - | '' | ||
| - | |||
| - | '' | ||
| - | |||
| - | < | ||
| - | guest.SetStatus(GuestStatus.Building); | ||
| - | </ | ||
| - | |||
| - | It also sets initial host/ | ||
| - | |||
| - | ==== 4. Provisioning assignments ==== | ||
| - | |||
| - | '' | ||
| - | |||
| - | '' | ||
| - | |||
| - | - '' | ||
| - | - '' | ||
| - | - '' | ||
| - | - '' | ||
| - | - '' | ||
| - | - '' | ||
| - | - '' | ||
| - | |||
| - | ===== HostCommand / HostDaemon Flow ===== | ||
| - | |||
| - | ==== 5. CreateGuestCommand is queued ==== | ||
| - | |||
| - | '' | ||
| - | |||
| - | '' | ||
| - | |||
| - | '' | ||
| - | |||
| - | The command has six visible steps: | ||
| - | |||
| - | - Requesting server resources | ||
| - | - Allocating virtual disk | ||
| - | - Installing operating system | ||
| - | - Starting server | ||
| - | - Configuring operating system | ||
| - | - Processing invoice | ||
| - | |||
| - | It implements '' | ||
| - | |||
| - | < | ||
| - | Guest.LatestLeaseTerm.Invoice | ||
| - | </ | ||
| - | |||
| - | ==== 6. HostDaemon picks up the command ==== | ||
| - | |||
| - | '' | ||
| - | |||
| - | HostDaemon repeatedly: | ||
| - | |||
| - | - asks '' | ||
| - | - calls '' | ||
| - | - starts '' | ||
| - | |||
| - | '' | ||
| - | |||
| - | ==== 7. HostDaemon creates the guest ==== | ||
| - | |||
| - | '' | ||
| - | |||
| - | '' | ||
| - | |||
| - | - blocks/ | ||
| - | - connects to the guest' | ||
| - | - checks banned-customer and disk-exists conditions; | ||
| - | - creates virtual disks; | ||
| - | - issues licences; | ||
| - | - installs the operating system; | ||
| - | - configures time machine if enabled; | ||
| - | - starts the guest; | ||
| - | - waits for ping/ | ||
| - | - finalises successful creation. | ||
| - | |||
| - | On successful creation, '' | ||
| - | |||
| - | < | ||
| - | command.Guest.SetStatus(GuestStatus.Active); | ||
| - | _guestService.Commit(command.Guest); | ||
| - | </ | ||
| - | |||
| - | So the source-backed transition is '' | ||
| - | |||
| - | ==== 8. Command completion ==== | ||
| - | |||
| - | '' | ||
| - | |||
| - | After the handler returns, '' | ||
| - | |||
| - | < | ||
| - | command.SetCompleted(); | ||
| - | broker.Commit(command); | ||
| - | handler.Completed(); | ||
| - | broker.Commit(command); | ||
| - | </ | ||
| - | |||
| - | There is no separate HTTP callback from HostDaemon to the API in this path. HostDaemon updates the shared database state directly through NHibernate/ | ||
| - | |||
| - | ===== Billing Behaviour ===== | ||
| - | |||
| - | There are two separate billing concerns: | ||
| - | |||
| - | * **Immediate API-side payment attempt:** '' | ||
| - | * **HostDaemon invoice gate:** '' | ||
| - | |||
| - | '' | ||
| - | |||
| - | * refreshes the customer; | ||
| - | * returns true if no payment is required; | ||
| - | * marks the invoice ready for sending; | ||
| - | * handles zero-dollar invoices; | ||
| - | * uses customer credit first; | ||
| - | * generates a credit-card deposit if needed and possible; | ||
| - | * subtracts customer credit for debit invoices; | ||
| - | * calls '' | ||
| - | |||
| - | HostDaemon does not appear to " | ||
| - | |||
| - | For postpaid invoices, '' | ||
| - | |||
| - | ===== Failure and Recovery Behaviour ===== | ||
| - | |||
| - | ==== Unpaid invoice / pending payment ==== | ||
| - | |||
| - | '' | ||
| - | |||
| - | If the blocking invoice is not paid: | ||
| - | |||
| - | * HostDaemon reschedules the command by default using '' | ||
| - | * It cancels instead when the invoice is overdue, cancelled/ | ||
| - | |||
| - | For create guest cancellation, | ||
| - | |||
| - | * ends the lease; | ||
| - | * cancels the invoice when needed; | ||
| - | * removes allocated resources from the guest; | ||
| - | * sets guest status to '' | ||
| - | * sends a guest-creation-cancelled email when appropriate. | ||
| - | |||
| - | ==== Exception during provisioning ==== | ||
| - | |||
| - | '' | ||
| - | |||
| - | * logs a '' | ||
| - | * removes generated password result data; | ||
| - | * attempts unclean poweroff; | ||
| - | * attempts to remove the primary disk; | ||
| - | * cancels/ | ||
| - | * ends the current lease; | ||
| - | * cancels the guest; | ||
| - | * sets guest status to '' | ||
| - | * revokes licences. | ||
| - | |||
| - | The comment explains that failed creates used to delete the guest entirely, but now leave it suspended so normal automatic termination can clean it up. | ||
| - | |||
| - | ==== Failure while recording command state ==== | ||
| - | |||
| - | '' | ||
| - | |||
| - | If command loading or committing fails, '' | ||
| - | |||
| - | ===== Data / State Transitions ===== | ||
| - | |||
| - | ^ Object ^ Initial / queued state ^ Successful state ^ Failure state ^ | ||
| - | | '' | ||
| - | | '' | ||
| - | | '' | ||
| - | | '' | ||
| - | | '' | ||
| - | |||
| - | ===== Support-Relevant Failure Points ===== | ||
| - | |||
| - | * Customer has unpaid/ | ||
| - | * Customer has no verified payment details / is not subscribed. | ||
| - | * Customer is at guest limit. | ||
| - | * Plan is inactive or not listable. | ||
| - | * No host/ | ||
| - | * HostCommand is blocked by another active command. | ||
| - | * Payment cannot be processed. | ||
| - | * HostDaemon cannot create disk, install OS, start guest, or reach guest by ping. | ||
| - | * HostDaemon/ | ||
| - | |||
| - | ===== Source Files ===== | ||
| - | |||
| - | * '' | ||
| - | * '' | ||
| - | * '' | ||
| - | * '' | ||
| - | * '' | ||
| - | * '' | ||
| - | * '' | ||
| - | * '' | ||
| - | * '' | ||
| - | * '' | ||
| - | * '' | ||
| - | * '' | ||
| - | * '' | ||
| - | |||
| - | ===== Remaining Questions ===== | ||
| - | |||
| - | * Which customer-visible status label maps to internal '' | ||
| - | * Which operational job performs automatic cleanup/ | ||
| - | * Which logs/ | ||
| - | |||
| - | ===== Related Wiki Pages ===== | ||
| - | |||
| - | * [[compute-host-stack|Compute Host Stack]] | ||
| - | * [[compute-repo-structure|vps/ | ||
| - | * [[infrastructure-services|Infrastructure Services]] | ||
| - | * [[wiki: | ||
syntheses/vps-create-flow.1784258136.txt.gz · Last modified: by 127.0.0.1
