gitee.com/leisunstar/runtime@v0.0.0-20200521203717-5cef3e7b53f9/virtcontainers/pkg/cloud-hypervisor/cloud-hypervisor.yaml (about)

     1  openapi: 3.0.1
     2  info:
     3    title: Cloud Hypervisor API
     4    description: Local HTTP based API for managing and inspecting a cloud-hypervisor virtual machine.
     5    license:
     6      name: Apache 2.0
     7      url: http://www.apache.org/licenses/LICENSE-2.0.html
     8    version: 0.3.0
     9  
    10  servers:
    11  - url: http://localhost/api/v1
    12  
    13  paths:
    14  
    15    /vmm.ping:
    16      get:
    17        summary: Ping the VMM to check for API server availability
    18        responses:
    19          200:
    20            description: The VMM information
    21            content:
    22              application/json:
    23                schema:
    24                  $ref: '#/components/schemas/VmmPingResponse'
    25  
    26    /vmm.shutdown:
    27      put:
    28        summary: Shuts the cloud-hypervisor VMM.
    29        operationId: shutdownVMM
    30        responses:
    31          204:
    32            description: The VMM successfully shutdown.
    33  
    34    /vm.info:
    35      get:
    36        summary: Returns general information about the cloud-hypervisor Virtual Machine (VM) instance.
    37        responses:
    38          200:
    39            description: The VM information
    40            content:
    41              application/json:
    42                schema:
    43                  $ref: '#/components/schemas/VmInfo'
    44  
    45    /vm.create:
    46      put:
    47        summary: Create the cloud-hypervisor Virtual Machine (VM) instance. The instance is not booted, only created.
    48        operationId: createVM
    49        requestBody:
    50          description: The VM configuration
    51          content:
    52            application/json:
    53              schema:
    54                $ref: '#/components/schemas/VmConfig'
    55          required: true
    56        responses:
    57          204:
    58            description: The VM instance was successfully created.
    59  
    60    /vm.delete:
    61      put:
    62        summary: Delete the cloud-hypervisor Virtual Machine (VM) instance.
    63        operationId: deleteVM
    64        responses:
    65          204:
    66            description: The VM instance was successfully deleted.
    67  
    68    /vm.boot:
    69      put:
    70        summary: Boot the previously created VM instance.
    71        operationId: bootVM
    72        responses:
    73          204:
    74            description: The VM instance successfully booted.
    75          404:
    76            description: The VM instance could not boot because it is not created yet
    77  
    78    /vm.pause:
    79      put:
    80        summary: Pause a previously booted VM instance.
    81        operationId: pauseVM
    82        responses:
    83          204:
    84            description: The VM instance successfully paused.
    85          404:
    86            description: The VM instance could not pause because it is not created yet
    87          405:
    88            description: The VM instance could not pause because it is not booted.
    89  
    90    /vm.resume:
    91      put:
    92        summary: Resume a previously paused VM instance.
    93        operationId: resumeVM
    94        responses:
    95          204:
    96            description: The VM instance successfully paused.
    97          404:
    98            description: The VM instance could not resume because it is not booted yet
    99          405:
   100            description: The VM instance could not resume because it is not paused.
   101  
   102    /vm.shutdown:
   103      put:
   104        summary: Shut the VM instance down.
   105        operationId: shutdownVM
   106        responses:
   107          204:
   108            description: The VM instance successfully shut down.
   109          404:
   110            description: The VM instance could not shut down because is not created.
   111          405:
   112            description: The VM instance could not shut down because it is not started.
   113  
   114    /vm.reboot:
   115      put:
   116        summary: Reboot the VM instance.
   117        operationId: rebootVM
   118        responses:
   119          204:
   120            description: The VM instance successfully rebooted.
   121          404:
   122            description: The VM instance could not reboot because it is not created.
   123          405:
   124            description: The VM instance could not reboot because it is not booted.
   125  
   126    /vm.resize:
   127      put:
   128        summary: Resize the VM
   129        requestBody:
   130          description: The target size for the VM
   131          content:
   132            application/json:
   133              schema:
   134                $ref: '#/components/schemas/VmResize'
   135          required: true
   136        responses:
   137          204:
   138            description: The VM instance was successfully resized.
   139          404:
   140            description: The VM instance could not be resized because it is not created.
   141  
   142    /vm.add-device:
   143      put:
   144        summary: Add a new device to the VM
   145        requestBody:
   146          description: The path of the new device
   147          content:
   148            application/json:
   149              schema:
   150                $ref: '#/components/schemas/VmAddDevice'
   151          required: true
   152        responses:
   153          204:
   154            description: The new device was successfully added to the VM instance.
   155          404:
   156            description: The new device could not be added to the VM instance.
   157  
   158    /vm.remove-device:
   159      put:
   160        summary: Remove a device from the VM
   161        requestBody:
   162          description: The identifier of the device
   163          content:
   164            application/json:
   165              schema:
   166                $ref: '#/components/schemas/VmRemoveDevice'
   167          required: true
   168        responses:
   169          204:
   170            description: The device was successfully removed from the VM instance.
   171          404:
   172            description: The device could not be removed from the VM instance.
   173  
   174    /vm.add-disk:
   175      put:
   176        summary: Add a new disk to the VM
   177        requestBody:
   178          description: The details of the new disk
   179          content:
   180            application/json:
   181              schema:
   182                $ref: '#/components/schemas/DiskConfig'
   183          required: true
   184        responses:
   185          204:
   186            description: The new disk was successfully added to the VM instance.
   187          500:
   188            description: The new disk could not be added to the VM instance.
   189  
   190    /vm.add-fs:
   191      put:
   192        summary: Add a new virtio-fs device to the VM
   193        requestBody:
   194          description: The details of the new virtio-fs
   195          content:
   196            application/json:
   197              schema:
   198                $ref: '#/components/schemas/FsConfig'
   199          required: true
   200        responses:
   201          204:
   202            description: The new device was successfully added to the VM instance.
   203          500:
   204            description: The new device could not be added to the VM instance.
   205  
   206    /vm.add-pmem:
   207      put:
   208        summary: Add a new pmem device to the VM
   209        requestBody:
   210          description: The details of the new pmem device
   211          content:
   212            application/json:
   213              schema:
   214                $ref: '#/components/schemas/PmemConfig'
   215          required: true
   216        responses:
   217          204:
   218            description: The new device was successfully added to the VM instance.
   219          500:
   220            description: The new device could not be added to the VM instance.
   221  
   222    /vm.add-net:
   223      put:
   224        summary: Add a new network device to the VM
   225        requestBody:
   226          description: The details of the new network device
   227          content:
   228            application/json:
   229              schema:
   230                $ref: '#/components/schemas/NetConfig'
   231          required: true
   232        responses:
   233          204:
   234            description: The new device was successfully added to the VM instance.
   235          500:
   236            description: The new device could not be added to the VM instance.
   237  
   238    /vm.add-vsock:
   239      put:
   240        summary: Add a new vsock device to the VM
   241        requestBody:
   242          description: The details of the new vsock device
   243          content:
   244            application/json:
   245              schema:
   246                $ref: '#/components/schemas/VsockConfig'
   247          required: true
   248        responses:
   249          204:
   250            description: The new device was successfully added to the VM instance.
   251          500:
   252            description: The new device could not be added to the VM instance.
   253  
   254  
   255    /vm.snapshot:
   256      put:
   257        summary: Returns a VM snapshot.
   258        requestBody:
   259          description: The snapshot configuration
   260          content:
   261            application/json:
   262              schema:
   263                $ref: '#/components/schemas/VmSnapshotConfig'
   264          required: true
   265        responses:
   266          204:
   267            description: The VM instance was successfully snapshotted.
   268          404:
   269            description: The VM instance could not be snapshotted because it is not created.
   270          405:
   271            description: The VM instance could not be snapshotted because it is not booted.
   272  
   273    /vm.restore:
   274      put:
   275        summary: Restore a VM from a snapshot.
   276        requestBody:
   277          description: The restore configuration
   278          content:
   279            application/json:
   280              schema:
   281                $ref: '#/components/schemas/RestoreConfig'
   282          required: true
   283        responses:
   284          204:
   285            description: The VM instance was successfully restored.
   286          404:
   287            description: The VM instance could not be restored because it is already created.
   288  
   289  components:
   290    schemas:
   291  
   292      VmmPingResponse:
   293        required:
   294        - version
   295        type: object
   296        properties:
   297          version:
   298            type: string
   299        description: Virtual Machine Monitor information
   300  
   301      VmInfo:
   302        required:
   303        - config
   304        - state
   305        type: object
   306        properties:
   307          config:
   308            $ref: '#/components/schemas/VmConfig'
   309          state:
   310            type: string
   311            enum: [Created, Running, Shutdown, Paused]
   312        description: Virtual Machine information
   313  
   314      VmConfig:
   315        required:
   316        - kernel
   317        - cmdline
   318        type: object
   319        properties:
   320          cpus:
   321            $ref: '#/components/schemas/CpusConfig'
   322          memory:
   323            $ref: '#/components/schemas/MemoryConfig'
   324          kernel:
   325            $ref: '#/components/schemas/KernelConfig'
   326          initramfs:
   327            $ref: '#/components/schemas/InitramfsConfig'
   328          cmdline:
   329            $ref: '#/components/schemas/CmdLineConfig'
   330          disks:
   331            type: array
   332            items:
   333              $ref: '#/components/schemas/DiskConfig'
   334          net:
   335            type: array
   336            items:
   337              $ref: '#/components/schemas/NetConfig'
   338          rng:
   339            $ref: '#/components/schemas/RngConfig'
   340          fs:
   341            type: array
   342            items:
   343              $ref: '#/components/schemas/FsConfig'
   344          pmem:
   345            type: array
   346            items:
   347              $ref: '#/components/schemas/PmemConfig'
   348          serial:
   349            $ref: '#/components/schemas/ConsoleConfig'
   350          console:
   351            $ref: '#/components/schemas/ConsoleConfig'
   352          devices:
   353            type: array
   354            items:
   355              $ref: '#/components/schemas/DeviceConfig'
   356          vsock:
   357              $ref: '#/components/schemas/VsockConfig'
   358          iommu:
   359            type: boolean
   360            default: false
   361        description: Virtual machine configuration
   362  
   363      CpusConfig:
   364        required:
   365        - boot_vcpus
   366        - max_vcpus
   367        type: object
   368        properties:
   369          boot_vcpus:
   370            minimum: 1
   371            default: 1
   372            type: integer
   373          max_vcpus:
   374            minimum: 1
   375            default: 1
   376            type: integer
   377  
   378      MemoryConfig:
   379        required:
   380        - size
   381        type: object
   382        properties:
   383          size:
   384            type: integer
   385            format: int64
   386            default: 512 MB
   387          hotplug_size:
   388            type: integer
   389            format: int64
   390          file:
   391            type: string
   392          mergeable:
   393            type: boolean
   394            default: false
   395          hotplug_method:
   396            type: string
   397            default: "acpi"
   398          shared:
   399            type: boolean
   400            default: false
   401          hugepages:
   402            type: boolean
   403            default: false
   404  
   405      KernelConfig:
   406        required:
   407        - path
   408        type: object
   409        properties:
   410          path:
   411            type: string
   412  
   413      InitramfsConfig:
   414        nullable: true
   415        required:
   416        - path
   417        type: object
   418        properties:
   419          path:
   420            type: string
   421  
   422      CmdLineConfig:
   423        required:
   424        - args
   425        type: object
   426        properties:
   427          args:
   428            type: string
   429  
   430      DiskConfig:
   431        required:
   432        - path
   433        type: object
   434        properties:
   435          path:
   436            type: string
   437          readonly:
   438            type: boolean
   439            default: false
   440          direct:
   441            type: boolean
   442            default: false
   443          iommu:
   444            type: boolean
   445            default: false
   446          num_queues:
   447            type: integer
   448            default: 1
   449          queue_size:
   450            type: integer
   451            default: 128
   452          vhost_user:
   453            type: boolean
   454            default: false
   455          vhost_socket:
   456            type: string
   457          wce:
   458            type: boolean
   459            default: true
   460          poll_queue:
   461            type: boolean
   462            default: true
   463          id:
   464            type: string
   465  
   466      NetConfig:
   467        type: object
   468        properties:
   469          tap:
   470            type: string
   471            default: ""
   472          ip:
   473            type: string
   474            default: "192.168.249.1"
   475          mask:
   476            type: string
   477            default: "255.255.255.0"
   478          mac:
   479            type: string
   480          iommu:
   481            type: boolean
   482            default: false
   483          num_queues:
   484            type: integer
   485            default: 2
   486          queue_size:
   487            type: integer
   488            default: 256
   489          vhost_user:
   490            type: boolean
   491            default: false
   492          vhost_socket:
   493            type: string
   494          id:
   495            type: string
   496  
   497      RngConfig:
   498        required:
   499        - src
   500        type: object
   501        properties:
   502          src:
   503            type: string
   504            default: "/dev/urandom"
   505          iommu:
   506            type: boolean
   507            default: false
   508  
   509      FsConfig:
   510        required:
   511        - tag
   512        - sock
   513        type: object
   514        properties:
   515          tag:
   516            type: string
   517          sock:
   518            type: string
   519          num_queues:
   520            type: integer
   521            default: 1
   522          queue_size:
   523            type: integer
   524            default: 1024
   525          dax:
   526            type: boolean
   527            default: true
   528          cache_size:
   529            type: integer
   530            format: int64
   531            default: 8589934592
   532          id:
   533            type: string
   534  
   535      PmemConfig:
   536        required:
   537        - file
   538        type: object
   539        properties:
   540          file:
   541            type: string
   542          size:
   543            type: integer
   544            format: int64
   545          iommu:
   546            type: boolean
   547            default: false
   548          mergeable:
   549            type: boolean
   550            default: false
   551          discard_writes:
   552            type: boolean
   553            default: false
   554          id:
   555            type: string
   556  
   557      ConsoleConfig:
   558        required:
   559        - mode
   560        type: object
   561        properties:
   562          file:
   563            type: string
   564          mode:
   565            type: string
   566            enum: [Off, Tty, File, Null]
   567          iommu:
   568            type: boolean
   569            default: false
   570  
   571      DeviceConfig:
   572        required:
   573        - path
   574        type: object
   575        properties:
   576          path:
   577            type: string
   578          iommu:
   579            type: boolean
   580            default: false
   581          id:
   582            type: string
   583  
   584      VsockConfig:
   585        required:
   586        - cid
   587        - sock
   588        type: object
   589        properties:
   590          cid:
   591            type: integer
   592            format: int64
   593            minimum: 3
   594            description: Guest Vsock CID
   595          sock:
   596            type: string
   597            description: Path to UNIX domain socket, used to proxy vsock connections.
   598          iommu:
   599            type: boolean
   600            default: false
   601          id:
   602            type: string
   603  
   604      VmResize:
   605        type: object
   606        properties:
   607          desired_vcpus:
   608            minimum: 1
   609            type: integer
   610          desired_ram:
   611            description: desired memory ram in bytes
   612            type: integer
   613            format: int64
   614  
   615      VmAddDevice:
   616        type: object
   617        properties:
   618          path:
   619            type: string
   620  
   621      VmRemoveDevice:
   622        type: object
   623        properties:
   624          id:
   625            type: string
   626  
   627      VmSnapshotConfig:
   628        type: object
   629        properties:
   630          destination_url:
   631            type: string
   632  
   633      RestoreConfig:
   634        required:
   635        - source_url
   636        type: object
   637        properties:
   638          source_url:
   639            type: string
   640          prefault:
   641            type: boolean