Commit 9f02b476 authored by garciadeblas's avatar garciadeblas
Browse files

Merge branch 'feature_10972_Support_of_volume_multi_attach' into 'master'

feature 10972 support of volume multi-attach

See merge request !127
parents 63d3a17f 2bcb3129
Loading
Loading
Loading
Loading
Loading
+157 −0
Original line number Diff line number Diff line
@@ -633,6 +633,163 @@ An existing persistent volume could be passed as an instantiation parameter by i

Where the `name` of the `persistent-storage` is the one in the descriptor, and the `vim-volume-id` is the ID of volume in Openstack to be used (instead of being created).

### Creating a deployment with a multi-attach volume

OSM supports the usage of multi-attach volumes when working with multiples VDUs in the same deployment. This feature only works in the Openstack Cloud environment and needs to be activated beforehand. Using `cinder`, create the volume type `multiattach` and activate it using the following commands:

```bash
$ cinder type-create multiattach
$ cinder type-key multiattach set multiattach="<is> True"
```

Verify that the configuration was has been applied by using the following command:

```bash
$ cinder type-list
+--------------------------------------+-------------+---------------------+-----------+
| ID                                   | Name        | Description         | Is_Public |
+--------------------------------------+-------------+---------------------+-----------+
| b365d243-0c21-45e2-8e41-aa975c4bd78c | __DEFAULT__ | Default Volume Type | True      |
| fdbf0985-86ca-4691-a5ba-9acb752bfed4 | multiattach | -                   | True      |
+--------------------------------------+-------------+---------------------+-----------+
```

Now, build a descriptor according to this feature: set `multiattach` flag as `true` under `vdu-storage-requirements` in the VNFD, then, add the volume id to both `vdu` under `virtual-storage-desc`, so it will attach itself to both VMs. The following is an example of a descriptor which generates a multi-attach volume:

```yaml
vnfd:
  description: A basic VNF descriptor w/ two VDU
  df:
  - id: default-df
    instantiation-level:
    - id: default-instantiation-level
      vdu-level:
      - number-of-instances: 1
        vdu-id: hackfest_basic-VM
      - number-of-instances: 1
        vdu-id: hackfest_basic-VM1  
    vdu-profile:
    - id: hackfest_basic-VM
      min-number-of-instances: 1
      affinity-or-anti-affinity-group:
      - id: affinity-group-1
    - id: hackfest_basic-VM1
      min-number-of-instances: 1
      affinity-or-anti-affinity-group:
      - id: affinity-group-1    
    affinity-or-anti-affinity-group:
    - id: affinity-group-1
      type: anti-affinity
      scope: nfvi-node
  ext-cpd:
  - id: vnf-cp0-ext
    int-cpd:
      cpd: vdu-eth0-int
      vdu-id: hackfest_basic-VM
  - id: vnf-cp1-ext
    int-cpd:
      cpd: vdu-eth0-int
      vdu-id: hackfest_basic-VM1
  id: hackfest_basic_multi-vnf
  mgmt-cp: vnf-cp0-ext
  product-name: hackfest_basic_multi-vnf
  sw-image-desc:
  - id: ubuntu18.04
    name: ubuntu18.04
    image: ubuntu18.04
  - id: ubuntu18.04-aws
    name: ubuntu18.04-aws
    image: ubuntu/images/hvm-ssd/ubuntu-artful-17.10-amd64-server-20180509
    vim-type: aws
  - id: ubuntu18.04-azure
    name: ubuntu18.04-azure
    image: Canonical:UbuntuServer:18.04-LTS:latest
    vim-type: azure
  - id: ubuntu18.04-gcp
    name: ubuntu18.04-gcp
    image: ubuntu-os-cloud:image-family:ubuntu-1804-lts
    vim-type: gcp
  vdu:
  - id: hackfest_basic-VM
    name: hackfest_basic-VM
    sw-image-desc: ubuntu18.04
    alternative-sw-image-desc:
    - ubuntu18.04-aws
    - ubuntu18.04-azure
    - ubuntu18.04-gcp
    virtual-compute-desc: hackfest_basic-VM-compute
    virtual-storage-desc:
    - root-volume        
    - hackfest_basic-VM-storage
    int-cpd:
    - id: vdu-eth0-int
      virtual-network-interface-requirement:
      - name: vdu-eth0
        virtual-interface:
          type: PARAVIRT
  - cloud-init: |
        #cloud-config
        password: osmpass
        chpasswd: { expire: False }
        ssh_pwauth: True 
    id: hackfest_basic-VM1
    name: hackfest_basic-VM1
    sw-image-desc: ubuntu18.04
    alternative-sw-image-desc:
    - ubuntu18.04-aws
    - ubuntu18.04-azure
    - ubuntu18.04-gcp
    virtual-compute-desc: hackfest_basic-VM-compute
    virtual-storage-desc:
    - root-volume
    - hackfest_basic-VM-storage
    int-cpd:
    - id: vdu-eth0-int
      virtual-network-interface-requirement:
      - name: vdu-eth0
        virtual-interface:
          type: PARAVIRT        
  version: 1.0
  virtual-compute-desc:
  - id: hackfest_basic-VM-compute
    virtual-cpu:
      num-virtual-cpu: 1
    virtual-memory:
      size: 1.0
  virtual-storage-desc:
  - id: root-volume
    size-of-storage: 5
  - id: hackfest_basic-VM-storage
    type-of-storage: persistent-storage
    size-of-storage: 10
    vdu-storage-requirements:
    - key: multiattach
      value: true
```

In this case, the volume `hackfest_basic-VM-storage` will be created under the name `shared-{virtual-storage-desc.id}-vnf` and will be the shared between both VMs. To check if it worked, run the `openstack volume list` and check if it is multi-attached to both VDUs.

```bash
+--------------------------------------+-----------------------------------------------------------+-----------+------+-------------------------------------------------------------------------------------------------------------------------+
| ID                                   | Name                                                      | Status    | Size | Attached to                                                                                                             |
+--------------------------------------+-----------------------------------------------------------+-----------+------+-------------------------------------------------------------------------------------------------------------------------+
| 91bf5674-5b85-41d1-aa3b-4848e2691088 | shared-hackfest_basic-VM-storage-hackfest_basic_multi-vnf | in-use    |   10 | Attached to multi_test-vnf-hackfest_basic-VM1-0 on /dev/vdb Attached to multi_test-vnf-hackfest_basic-VM-0 on /dev/vdb  |
+--------------------------------------+-----------------------------------------------------------+-----------+------+-------------------------------------------------------------------------------------------------------------------------+
```

It is possible to add the the flag `keep-volume` so the volume will stay on Openstack after deleting the VM. Add the key in the `vdu-storage-requirements` to make it work:

```yaml
vdu-storage-requirements:
- key: multiattach
  value: true
- key: keep-volume
  value: true
```

If the value for the `keep-volume` key is set to `false`, or if the key does not exist, the volume will be deleted from OpenStack along with the VMs when the NS (Network Service) is deleted.


### Using existing flavors (OpenStack only)

Typically, OSM creates the flavors needed by the VDUs, which are specified by the `virtual-compute-desc` parameter in the VNFD. In some cases, flavors must contain a complex EPA configuration that is not supported by descriptors, so they need to be created manually in the VIM beforehand.