[
https://issues.apache.org/jira/browse/JCLOUDS-1415?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16580187#comment-16580187
]
Mathieu Tortuyaux commented on JCLOUDS-1415:
--------------------------------------------
Hi [~nacx],
I've started to work on this issue. I've been able to create a GCE instance
with a shared VPC from another project by giving the full URI. :D
However, I need to do a "hack":
If i give the URI of the subnetwork:
{code:java}
templateOptions.networks("projects/a-google-project/regions/a-google-region/subnetworks/a-subnetwork");
{code}
It'll try to get the resource with this REST request:
{code}
2018-08-13 21:23:07,727 DEBUG
[org.jclouds.http.internal.JavaUrlHttpCommandExecutorService] [main] Sending
request -626967663: GET
https://www.googleapis.com/compute/projects/a-google-project/regions/a-google-region/subnetworks/a-subnetwork
HTTP/1.1
2018-08-13 21:23:08,445 DEBUG
[org.jclouds.http.internal.JavaUrlHttpCommandExecutorService] [main] Receiving
response -626967663: HTTP/1.1 404 Not Found
{code}
Because "v1" is missing in the URL: /compute/*v1*/projects/...
So I'm able to create the resource if I give the URI as:
{code:java}
templateOptions.networks("v1/projects/a-google-project/regions/a-google-region/subnetworks/a-subnetwork");
{code}
But it's not really nice... Any ideas ?
> Does Jclouds support shared VPC
> -------------------------------
>
> Key: JCLOUDS-1415
> URL: https://issues.apache.org/jira/browse/JCLOUDS-1415
> Project: jclouds
> Issue Type: Bug
> Components: jclouds-compute, jclouds-labs-google
> Affects Versions: 2.1.0
> Environment: 4.15.15-1-ARCH x86_64
> Reporter: Mathieu Tortuyaux
> Priority: Minor
> Labels: google-compute-engine
>
> Hi !
> I am using Jclouds in order to create instances on multi-cloud providers.
> However, with Google Compute Engine I have a shared vpc on a project:
> _vpc_project_ and my project is running under _current_project_.
> When I add to the template this network:
>
> {noformat}
> templateBuilder.locationId("northamerica-northeast1-c");
> templateOptions.networks("projects/vpc_project/regions/northamerica-northeast1/subnetworks/net-vpc-project");
> {noformat}
> I got the following error:
> {noformat}
> 2018-04-30 11:00:57,989 WARN [jclouds.compute] [main] >>
> subnet(net-vpc-project) was not found in region(northamerica-northeast1).
> Trying to find a matching legacy network...
> {noformat}
> And in wired logs:
> {noformat}
> The resource
> 'projects/current_project/regions/northamerica-northeast1/subnetworks/net-vpc-project
> was not found
> {noformat}
> So Jclouds is able to know that I'm trying to add a subnetwork to my
> template, but he's trying to load it from _current_project_ and not from
> _vpc_project_.
> I am running with JClouds 2.1.0 and my Google Service Account is able to use
> network from _vpc_project_.
> In my opinon, we should add an option like:
> {noformat}
> template.networkProjectId("vpc_project")
> {noformat}
> Or parsing the URI given to networks.
> Or maybe I am totally wrong. :)
> Thanks !
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)