Fix Generic driver DHSS=False setup

Nova API started having bug where it does not list servers that really
exist. So, avoid this bug in manila parsing answer of "create" command
instead of doing second request with name of VM to get its ID.

Change-Id: Ice8e297e9055df6eec83d2c8f4b9932ad52a612f
Related-Bug: #1659391
This commit is contained in:
vponomaryov 2017-01-26 16:19:55 +02:00
parent c4da03274c
commit 0f96b433e6
1 changed files with 6 additions and 5 deletions

View File

@ -296,18 +296,19 @@ function create_service_share_servers {
local vm_exists=$( openstack server list --all-projects | grep " $vm_name " ) local vm_exists=$( openstack server list --all-projects | grep " $vm_name " )
if [[ -z $vm_exists ]]; then if [[ -z $vm_exists ]]; then
private_net_id=$(openstack network show $PRIVATE_NETWORK_NAME -f value -c id) private_net_id=$(openstack network show $PRIVATE_NETWORK_NAME -f value -c id)
openstack server create $vm_name \ vm_id=$(openstack server create $vm_name \
--flavor $MANILA_SERVICE_VM_FLAVOR_NAME \ --flavor $MANILA_SERVICE_VM_FLAVOR_NAME \
--image $MANILA_SERVICE_IMAGE_NAME \ --image $MANILA_SERVICE_IMAGE_NAME \
--nic net-id=$private_net_id \ --nic net-id=$private_net_id \
--security-group $MANILA_SERVICE_SECGROUP \ --security-group $MANILA_SERVICE_SECGROUP \
--key-name $MANILA_SERVICE_KEYPAIR_NAME --key-name $MANILA_SERVICE_KEYPAIR_NAME \
| grep ' id ' | get_field 2)
else
vm_id=$(openstack server show $vm_name -f value -c id)
fi fi
vm_id=$(openstack server show $vm_name -f value -c id)
floating_ip=$(openstack floating ip create $PUBLIC_NETWORK_NAME --subnet $PUBLIC_SUBNET_NAME | grep 'floating_ip_address' | get_field 2) floating_ip=$(openstack floating ip create $PUBLIC_NETWORK_NAME --subnet $PUBLIC_SUBNET_NAME | grep 'floating_ip_address' | get_field 2)
openstack server add floating ip $vm_name $floating_ip openstack server add floating ip $vm_id $floating_ip
iniset $MANILA_CONF $BE service_instance_name_or_id $vm_id iniset $MANILA_CONF $BE service_instance_name_or_id $vm_id
iniset $MANILA_CONF $BE service_net_name_or_ip $floating_ip iniset $MANILA_CONF $BE service_net_name_or_ip $floating_ip