[
https://issues.apache.org/jira/browse/JCLOUDS-1415?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16460748#comment-16460748
]
Ignasi Barrera commented on JCLOUDS-1415:
-----------------------------------------
Yes, that seems to be the offending line. Here are some pointers if you want to
go for this:
Access to the subnet is done in a couple places, and you'll have to change both:
https://github.com/jclouds/jclouds/blob/master/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/GoogleComputeEngineServiceAdapter.java#L145
https://github.com/jclouds/jclouds/blob/master/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/strategy/CreateNodesWithGroupEncodedIntoNameThenAddToSet.java#L161
This is the class that loads the subnets to the cache:
https://github.com/jclouds/jclouds/blob/master/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/loaders/SubnetworkLoader.java
It would be a good idea perhaps to use a different object instead of that
RegionAndName. Perhaps one that apart from the region and name had the URI of
the object and tried to get it by URI if the first call fails and the URI is
present. There is already an API in place to get a subnet by its URI:
https://github.com/jclouds/jclouds/blob/master/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/functions/Resources.java#L86-L88
Wherever you need to call it, you can just declare that {{Resources}} object as
a class variable and get it injected.
If you want more direct help, you'll find us in the #jclouds IRC channel at
Freenode on in the Slack channel!
> 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)