mirror of
https://github.com/OpenNebula/one.git
synced 2025-01-11 05:17:41 +03:00
Feature #4215: Reverse NETWORK and NETWORK_ID priority
When requesting a vnet, NETWORK had priority over _ID. If the NIC was taken from the VR, the NETWORK was set but the _UNAME or _UID was not. In this case, VR instantiate only worked for the owner of the VNet. The priority of IMAGE and IMAGE_ID for disks is also reversed, for consistency
This commit is contained in:
parent
d4867b44ae
commit
7410c78981
@ -322,7 +322,24 @@ int ImagePool::acquire_disk(int vm_id,
|
||||
|
||||
*snap = 0;
|
||||
|
||||
if (!(source = disk->vector_value("IMAGE")).empty())
|
||||
if (!(source = disk->vector_value("IMAGE_ID")).empty())
|
||||
{
|
||||
iid = get_disk_id(source);
|
||||
|
||||
if ( iid == -1)
|
||||
{
|
||||
error_str = "Wrong ID set in IMAGE_ID";
|
||||
return -1;
|
||||
}
|
||||
|
||||
img = imagem->acquire_image(vm_id, iid, error_str);
|
||||
|
||||
if ( img == 0 )
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
else if (!(source = disk->vector_value("IMAGE")).empty())
|
||||
{
|
||||
int uiid = get_disk_uid(disk,uid);
|
||||
|
||||
@ -346,23 +363,6 @@ int ImagePool::acquire_disk(int vm_id,
|
||||
|
||||
iid = img->get_oid();
|
||||
}
|
||||
else if (!(source = disk->vector_value("IMAGE_ID")).empty())
|
||||
{
|
||||
iid = get_disk_id(source);
|
||||
|
||||
if ( iid == -1)
|
||||
{
|
||||
error_str = "Wrong ID set in IMAGE_ID";
|
||||
return -1;
|
||||
}
|
||||
|
||||
img = imagem->acquire_image(vm_id, iid, error_str);
|
||||
|
||||
if ( img == 0 )
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
else //Not using the image repository (volatile DISK)
|
||||
{
|
||||
string type = disk->vector_value("TYPE");
|
||||
|
@ -253,14 +253,14 @@ int VirtualNetworkPool::nic_attribute(
|
||||
|
||||
nic->replace("NIC_ID", nic_id);
|
||||
|
||||
if (!(network = nic->vector_value("NETWORK")).empty())
|
||||
{
|
||||
vnet = get_nic_by_name (nic, network, uid, error);
|
||||
}
|
||||
else if (!(network = nic->vector_value("NETWORK_ID")).empty())
|
||||
if (!(network = nic->vector_value("NETWORK_ID")).empty())
|
||||
{
|
||||
vnet = get_nic_by_id(network, error);
|
||||
}
|
||||
else if (!(network = nic->vector_value("NETWORK")).empty())
|
||||
{
|
||||
vnet = get_nic_by_name (nic, network, uid, error);
|
||||
}
|
||||
else //Not using a pre-defined network
|
||||
{
|
||||
return -2;
|
||||
|
Loading…
Reference in New Issue
Block a user