mirror of https://github.com/apache/jclouds.git
Issue 495:vcloud: NullPointerExceptions when a VM has no IP addresses
This commit is contained in:
parent
87f6bdcce8
commit
9117644f26
|
@ -20,13 +20,15 @@
|
|||
package org.jclouds.vcloud.compute.functions;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
import static com.google.common.base.Predicates.not;
|
||||
import static com.google.common.collect.Iterables.filter;
|
||||
import static org.jclouds.compute.util.ComputeServiceUtils.parseGroupFromName;
|
||||
import static org.jclouds.vcloud.compute.util.VCloudComputeUtils.getCredentialsFrom;
|
||||
import static org.jclouds.vcloud.compute.util.VCloudComputeUtils.getPrivateIpsFromVApp;
|
||||
import static org.jclouds.vcloud.compute.util.VCloudComputeUtils.getPublicIpsFromVApp;
|
||||
import static org.jclouds.vcloud.compute.util.VCloudComputeUtils.getIpsFromVApp;
|
||||
import static org.jclouds.vcloud.compute.util.VCloudComputeUtils.toComputeOs;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.inject.Inject;
|
||||
|
@ -38,6 +40,7 @@ import org.jclouds.compute.domain.NodeMetadataBuilder;
|
|||
import org.jclouds.compute.domain.NodeState;
|
||||
import org.jclouds.domain.Credentials;
|
||||
import org.jclouds.logging.Logger;
|
||||
import org.jclouds.util.InetAddresses2.IsPrivateIPAddress;
|
||||
import org.jclouds.vcloud.domain.Status;
|
||||
import org.jclouds.vcloud.domain.VApp;
|
||||
|
||||
|
@ -58,7 +61,7 @@ public class VAppToNodeMetadata implements Function<VApp, NodeMetadata> {
|
|||
|
||||
@Inject
|
||||
protected VAppToNodeMetadata(Map<Status, NodeState> vAppStatusToNodeState, Map<String, Credentials> credentialStore,
|
||||
FindLocationForResource findLocationForResourceInVDC, Function<VApp, Hardware> hardwareForVApp) {
|
||||
FindLocationForResource findLocationForResourceInVDC, Function<VApp, Hardware> hardwareForVApp) {
|
||||
this.hardwareForVApp = checkNotNull(hardwareForVApp, "hardwareForVApp");
|
||||
this.findLocationForResourceInVDC = checkNotNull(findLocationForResourceInVDC, "findLocationForResourceInVDC");
|
||||
this.credentialStore = checkNotNull(credentialStore, "credentialStore");
|
||||
|
@ -75,8 +78,9 @@ public class VAppToNodeMetadata implements Function<VApp, NodeMetadata> {
|
|||
builder.operatingSystem(toComputeOs(from, null));
|
||||
builder.hardware(hardwareForVApp.apply(from));
|
||||
builder.state(vAppStatusToNodeState.get(from.getStatus()));
|
||||
builder.publicAddresses(getPublicIpsFromVApp(from));
|
||||
builder.privateAddresses(getPrivateIpsFromVApp(from));
|
||||
Set<String> addresses = getIpsFromVApp(from);
|
||||
builder.publicAddresses(filter(addresses, not(IsPrivateIPAddress.INSTANCE)));
|
||||
builder.privateAddresses(filter(addresses, IsPrivateIPAddress.INSTANCE));
|
||||
builder.credentials(getCredentialsFrom(from));
|
||||
Credentials fromApi = getCredentialsFrom(from);
|
||||
if (fromApi != null && !credentialStore.containsKey("node#" + from.getHref().toASCIIString()))
|
||||
|
|
|
@ -36,8 +36,9 @@ import org.jclouds.vcloud.domain.ovf.ResourceAllocation;
|
|||
import org.jclouds.vcloud.domain.ovf.ResourceType;
|
||||
import org.jclouds.vcloud.domain.ovf.VCloudNetworkAdapter;
|
||||
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.collect.ImmutableSet.Builder;
|
||||
import com.google.common.collect.Iterables;
|
||||
import com.google.common.collect.Sets;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -77,7 +78,7 @@ public class VCloudComputeUtils {
|
|||
public static Credentials getCredentialsFrom(Vm vm) {
|
||||
String user = "root";
|
||||
if (vm.getOperatingSystemSection() != null && vm.getOperatingSystemSection().getDescription() != null
|
||||
&& vm.getOperatingSystemSection().getDescription().indexOf("Windows") >= 0)
|
||||
&& vm.getOperatingSystemSection().getDescription().indexOf("Windows") >= 0)
|
||||
user = "Administrator";
|
||||
String password = null;
|
||||
if (vm.getGuestCustomizationSection() != null)
|
||||
|
@ -85,34 +86,33 @@ public class VCloudComputeUtils {
|
|||
return new Credentials(user, password);
|
||||
}
|
||||
|
||||
public static Set<String> getPublicIpsFromVApp(VApp vApp) {
|
||||
Set<String> ips = Sets.newLinkedHashSet();
|
||||
public static Set<String> getIpsFromVApp(VApp vApp) {
|
||||
// TODO make this work with composite vApps
|
||||
if (vApp.getChildren().size() == 0)
|
||||
return ips;
|
||||
return ImmutableSet.of();
|
||||
Builder<String> ips = ImmutableSet.<String> builder();
|
||||
Vm vm = Iterables.get(vApp.getChildren(), 0);
|
||||
// TODO: figure out how to differentiate public from private ip addresses
|
||||
// assumption is that we'll do this from the network object, which may have
|
||||
// enough data to tell whether or not it is a public network without string
|
||||
// parsing. At worst, we could have properties set per cloud provider to
|
||||
// declare the networks which are public, then check against these in
|
||||
// parsing. At worst, we could have properties set per cloud provider to
|
||||
// declare the networks which are public, then check against these in
|
||||
// networkconnection.getNetwork
|
||||
if (vm.getNetworkConnectionSection() != null) {
|
||||
for (NetworkConnection connection : vm.getNetworkConnectionSection().getConnections())
|
||||
ips.add(connection.getIpAddress());
|
||||
for (NetworkConnection connection : vm.getNetworkConnectionSection().getConnections()) {
|
||||
if (connection.getIpAddress() != null)
|
||||
ips.add(connection.getIpAddress());
|
||||
}
|
||||
} else {
|
||||
for (ResourceAllocation net : filter(vm.getVirtualHardwareSection().getResourceAllocations(),
|
||||
resourceType(ResourceType.ETHERNET_ADAPTER))) {
|
||||
resourceType(ResourceType.ETHERNET_ADAPTER))) {
|
||||
if (net instanceof VCloudNetworkAdapter) {
|
||||
VCloudNetworkAdapter vNet = VCloudNetworkAdapter.class.cast(net);
|
||||
ips.add(vNet.getIpAddress());
|
||||
if (vNet.getIpAddress() != null)
|
||||
ips.add(vNet.getIpAddress());
|
||||
}
|
||||
}
|
||||
}
|
||||
return ips;
|
||||
}
|
||||
|
||||
public static Set<String> getPrivateIpsFromVApp(VApp vApp) {
|
||||
return Sets.newLinkedHashSet();
|
||||
return ips.build();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,67 @@
|
|||
/**
|
||||
*
|
||||
* Copyright (C) 2010 Cloud Conscious, LLC. <info@cloudconscious.com>
|
||||
*
|
||||
* ====================================================================
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* ====================================================================
|
||||
*/
|
||||
|
||||
package org.jclouds.vcloud.compute.functions;
|
||||
|
||||
import static org.testng.Assert.assertEquals;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.NoSuchElementException;
|
||||
import java.util.Set;
|
||||
|
||||
import org.jclouds.domain.Location;
|
||||
import org.jclouds.domain.LocationBuilder;
|
||||
import org.jclouds.domain.LocationScope;
|
||||
import org.jclouds.vcloud.domain.internal.ReferenceTypeImpl;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.common.base.Suppliers;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
|
||||
/**
|
||||
* Tests behavior of {@code FindLocationForResource}
|
||||
*
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
@Test(groups = "unit")
|
||||
public class FindLocationForResourceTest {
|
||||
public void testMatchWhenIdIsHref() {
|
||||
Location location = new LocationBuilder().id("http://foo").description("description")
|
||||
.scope(LocationScope.PROVIDER).build();
|
||||
FindLocationForResource converter = new FindLocationForResource(
|
||||
Suppliers.<Set<? extends Location>> ofInstance(ImmutableSet.<Location> of(location)));
|
||||
assertEquals(converter.apply(new ReferenceTypeImpl("name", "type", URI.create("http://foo"))), location);
|
||||
}
|
||||
|
||||
@Test(expectedExceptions = NoSuchElementException.class)
|
||||
public void testGracefulWhenHrefIsntLocationId() {
|
||||
FindLocationForResource converter = new FindLocationForResource(
|
||||
Suppliers.<Set<? extends Location>> ofInstance(ImmutableSet.<Location> of(new LocationBuilder()
|
||||
.id("http://bar").description("description").scope(LocationScope.PROVIDER).build())));
|
||||
converter.apply(new ReferenceTypeImpl("name", "type", URI.create("http://foo")));
|
||||
}
|
||||
|
||||
@Test(expectedExceptions = NoSuchElementException.class)
|
||||
public void testGracefulWhenLocationIdIsntURI() {
|
||||
FindLocationForResource converter = new FindLocationForResource(
|
||||
Suppliers.<Set<? extends Location>> ofInstance(ImmutableSet.<Location> of(new LocationBuilder().id("1")
|
||||
.description("description").scope(LocationScope.PROVIDER).build())));
|
||||
converter.apply(new ReferenceTypeImpl("name", "type", URI.create("http://foo")));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,148 @@
|
|||
/**
|
||||
*
|
||||
* Copyright (C) 2010 Cloud Conscious, LLC. <info@cloudconscious.com>
|
||||
*
|
||||
* ====================================================================
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* ====================================================================
|
||||
*/
|
||||
|
||||
package org.jclouds.vcloud.compute.functions;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
import static org.testng.Assert.assertEquals;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.util.Map;
|
||||
import java.util.NoSuchElementException;
|
||||
import java.util.Properties;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import org.jclouds.collect.Memoized;
|
||||
import org.jclouds.compute.domain.Hardware;
|
||||
import org.jclouds.compute.domain.NodeMetadata;
|
||||
import org.jclouds.compute.domain.NodeState;
|
||||
import org.jclouds.domain.Credentials;
|
||||
import org.jclouds.domain.Location;
|
||||
import org.jclouds.domain.LocationBuilder;
|
||||
import org.jclouds.domain.LocationScope;
|
||||
import org.jclouds.http.functions.ParseSax;
|
||||
import org.jclouds.http.functions.ParseSax.Factory;
|
||||
import org.jclouds.http.functions.config.SaxParserModule;
|
||||
import org.jclouds.vcloud.VCloudPropertiesBuilder;
|
||||
import org.jclouds.vcloud.compute.config.CommonVCloudComputeServiceContextModule;
|
||||
import org.jclouds.vcloud.domain.Status;
|
||||
import org.jclouds.vcloud.domain.VApp;
|
||||
import org.jclouds.vcloud.xml.VAppHandler;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.common.base.Function;
|
||||
import com.google.common.base.Supplier;
|
||||
import com.google.common.base.Suppliers;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.google.inject.AbstractModule;
|
||||
import com.google.inject.Guice;
|
||||
import com.google.inject.Injector;
|
||||
import com.google.inject.Provides;
|
||||
import com.google.inject.TypeLiteral;
|
||||
import com.google.inject.name.Names;
|
||||
|
||||
/**
|
||||
* Tests behavior of {@code VAppToNodeMetadata}
|
||||
*
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
@Test(groups = "unit")
|
||||
public class VAppToNodeMetadataTest {
|
||||
|
||||
public Injector createInjectorWithLocation(final Location location) {
|
||||
return Guice.createInjector(new SaxParserModule(), new AbstractModule() {
|
||||
|
||||
@Override
|
||||
protected void configure() {
|
||||
Properties props = new Properties();
|
||||
Names.bindProperties(binder(), checkNotNull(new VCloudPropertiesBuilder(props).build(), "properties"));
|
||||
bind(new TypeLiteral<Function<VApp, Hardware>>() {
|
||||
}).to(new TypeLiteral<HardwareForVApp>() {
|
||||
});
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
@Memoized
|
||||
@Singleton
|
||||
@Provides
|
||||
Supplier<Set<? extends Location>> supplyLocations() {
|
||||
return Suppliers.<Set<? extends Location>> ofInstance(ImmutableSet.<Location> of(location));
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
@Singleton
|
||||
@Provides
|
||||
Map<String, Credentials> supplyCreds() {
|
||||
return Maps.newConcurrentMap();
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
@Singleton
|
||||
@Provides
|
||||
protected Map<Status, NodeState> provideVAppStatusToNodeState() {
|
||||
return CommonVCloudComputeServiceContextModule.VAPPSTATUS_TO_NODESTATE;
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
public void testWhenVDCIsLocation() {
|
||||
Location location = new LocationBuilder().id("https://1.1.1.1/api/v1.0/vdc/1").description("description")
|
||||
.scope(LocationScope.PROVIDER).build();
|
||||
Injector injector = createInjectorWithLocation(location);
|
||||
InputStream is = getClass().getResourceAsStream("/vapp-pool.xml");
|
||||
Factory factory = injector.getInstance(ParseSax.Factory.class);
|
||||
VApp result = factory.create(injector.getInstance(VAppHandler.class)).parse(is);
|
||||
VAppToNodeMetadata converter = injector.getInstance(VAppToNodeMetadata.class);
|
||||
NodeMetadata node = converter.apply(result);
|
||||
assertEquals(node.getLocation(), location);
|
||||
assertEquals(node.getPrivateAddresses(), ImmutableSet.of("172.16.7.230"));
|
||||
assertEquals(node.getPublicAddresses(), ImmutableSet.of());
|
||||
}
|
||||
|
||||
public void testGracefulWhenNoIPs() {
|
||||
Location location = new LocationBuilder().id("https://1.1.1.1/api/v1.0/vdc/1").description("description")
|
||||
.scope(LocationScope.PROVIDER).build();
|
||||
Injector injector = createInjectorWithLocation(location);
|
||||
InputStream is = getClass().getResourceAsStream("/vapp-none.xml");
|
||||
Factory factory = injector.getInstance(ParseSax.Factory.class);
|
||||
VApp result = factory.create(injector.getInstance(VAppHandler.class)).parse(is);
|
||||
VAppToNodeMetadata converter = injector.getInstance(VAppToNodeMetadata.class);
|
||||
NodeMetadata node = converter.apply(result);
|
||||
assertEquals(node.getLocation(), location);
|
||||
assertEquals(node.getPrivateAddresses(), ImmutableSet.of());
|
||||
assertEquals(node.getPublicAddresses(), ImmutableSet.of());
|
||||
}
|
||||
|
||||
@Test(expectedExceptions = NoSuchElementException.class)
|
||||
public void testGracefulWhenVDCIsNotLocation() {
|
||||
Location location = new LocationBuilder().id("https://1.1.1.1/api/v1.0/vdc/11111").description("description")
|
||||
.scope(LocationScope.PROVIDER).build();
|
||||
Injector injector = createInjectorWithLocation(location);
|
||||
InputStream is = getClass().getResourceAsStream("/vapp-pool.xml");
|
||||
Factory factory = injector.getInstance(ParseSax.Factory.class);
|
||||
VApp result = factory.create(injector.getInstance(VAppHandler.class)).parse(is);
|
||||
VAppToNodeMetadata converter = injector.getInstance(VAppToNodeMetadata.class);
|
||||
NodeMetadata node = converter.apply(result);
|
||||
assertEquals(node.getLocation(), location);
|
||||
}
|
||||
}
|
|
@ -46,6 +46,7 @@ import com.google.inject.Injector;
|
|||
*/
|
||||
@Test(groups = "unit")
|
||||
public class VAppHandlerTest {
|
||||
|
||||
public void testRhelOffStatic() {
|
||||
InputStream is = getClass().getResourceAsStream("/vapp-rhel-off-static.xml");
|
||||
Injector injector = Guice.createInjector(new SaxParserModule());
|
||||
|
@ -55,8 +56,10 @@ public class VAppHandlerTest {
|
|||
assertEquals(result.getHref(), URI.create("https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-607806320"));
|
||||
assertEquals(result.getType(), "application/vnd.vmware.vcloud.vApp+xml");
|
||||
assertEquals(result.getStatus(), Status.OFF);
|
||||
assertEquals(result.getVDC(), new ReferenceTypeImpl(null, VCloudMediaType.VDC_XML, URI
|
||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vdc/1014839439")));
|
||||
assertEquals(
|
||||
result.getVDC(),
|
||||
new ReferenceTypeImpl(null, VCloudMediaType.VDC_XML, URI
|
||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vdc/1014839439")));
|
||||
assertEquals(result.getDescription(), null);
|
||||
assertEquals(result.getTasks(), ImmutableList.of());
|
||||
assert result.isOvfDescriptorUploaded();
|
||||
|
|
|
@ -0,0 +1,170 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
|
||||
|
||||
Copyright (C) 2010 Cloud Conscious, LLC.
|
||||
<info@cloudconscious.com>
|
||||
|
||||
====================================================================
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0 Unless required by
|
||||
applicable law or agreed to in writing, software distributed
|
||||
under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions
|
||||
and limitations under the License.
|
||||
====================================================================
|
||||
-->
|
||||
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
|
||||
|
||||
<!--
|
||||
For more configuration infromation and examples see the Apache
|
||||
Log4j website: http://logging.apache.org/log4j/
|
||||
-->
|
||||
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/"
|
||||
debug="false">
|
||||
|
||||
<!-- A time/date based rolling appender -->
|
||||
<appender name="WIREFILE" class="org.apache.log4j.DailyRollingFileAppender">
|
||||
<param name="File" value="target/test-data/jclouds-wire.log" />
|
||||
<param name="Append" value="true" />
|
||||
|
||||
<!-- Rollover at midnight each day -->
|
||||
<param name="DatePattern" value="'.'yyyy-MM-dd" />
|
||||
|
||||
<param name="Threshold" value="TRACE" />
|
||||
|
||||
<layout class="org.apache.log4j.PatternLayout">
|
||||
<!-- The default pattern: Date Priority [Category] Message\n -->
|
||||
<param name="ConversionPattern" value="%d %-5p [%c] (%t) %m%n" />
|
||||
|
||||
<!--
|
||||
The full pattern: Date MS Priority [Category]
|
||||
(Thread:NDC) Message\n <param name="ConversionPattern"
|
||||
value="%d %-5r %-5p [%c] (%t:%x) %m%n"/>
|
||||
-->
|
||||
</layout>
|
||||
</appender>
|
||||
|
||||
<!-- A time/date based rolling appender -->
|
||||
<appender name="FILE" class="org.apache.log4j.DailyRollingFileAppender">
|
||||
<param name="File" value="target/test-data/jclouds.log" />
|
||||
<param name="Append" value="true" />
|
||||
|
||||
<!-- Rollover at midnight each day -->
|
||||
<param name="DatePattern" value="'.'yyyy-MM-dd" />
|
||||
|
||||
<param name="Threshold" value="TRACE" />
|
||||
|
||||
<layout class="org.apache.log4j.PatternLayout">
|
||||
<!-- The default pattern: Date Priority [Category] Message\n -->
|
||||
<param name="ConversionPattern" value="%d %-5p [%c] (%t) %m%n" />
|
||||
|
||||
<!--
|
||||
The full pattern: Date MS Priority [Category]
|
||||
(Thread:NDC) Message\n <param name="ConversionPattern"
|
||||
value="%d %-5r %-5p [%c] (%t:%x) %m%n"/>
|
||||
-->
|
||||
</layout>
|
||||
</appender>
|
||||
|
||||
<!-- A time/date based rolling appender -->
|
||||
<appender name="COMPUTEFILE" class="org.apache.log4j.DailyRollingFileAppender">
|
||||
<param name="File" value="target/test-data/jclouds-compute.log" />
|
||||
<param name="Append" value="true" />
|
||||
|
||||
<!-- Rollover at midnight each day -->
|
||||
<param name="DatePattern" value="'.'yyyy-MM-dd" />
|
||||
|
||||
<param name="Threshold" value="TRACE" />
|
||||
|
||||
<layout class="org.apache.log4j.PatternLayout">
|
||||
<!-- The default pattern: Date Priority [Category] Message\n -->
|
||||
<param name="ConversionPattern" value="%d %-5p [%c] (%t) %m%n" />
|
||||
|
||||
<!--
|
||||
The full pattern: Date MS Priority [Category]
|
||||
(Thread:NDC) Message\n <param name="ConversionPattern"
|
||||
value="%d %-5r %-5p [%c] (%t:%x) %m%n"/>
|
||||
-->
|
||||
</layout>
|
||||
</appender>
|
||||
|
||||
<!-- A time/date based rolling appender -->
|
||||
<appender name="SSHFILE" class="org.apache.log4j.DailyRollingFileAppender">
|
||||
<param name="File" value="target/test-data/jclouds-ssh.log" />
|
||||
<param name="Append" value="true" />
|
||||
|
||||
<!-- Rollover at midnight each day -->
|
||||
<param name="DatePattern" value="'.'yyyy-MM-dd" />
|
||||
|
||||
<param name="Threshold" value="TRACE" />
|
||||
|
||||
<layout class="org.apache.log4j.PatternLayout">
|
||||
<!-- The default pattern: Date Priority [Category] Message\n -->
|
||||
<param name="ConversionPattern" value="%d %-5p [%c] (%t) %m%n" />
|
||||
|
||||
<!--
|
||||
The full pattern: Date MS Priority [Category]
|
||||
(Thread:NDC) Message\n <param name="ConversionPattern"
|
||||
value="%d %-5r %-5p [%c] (%t:%x) %m%n"/>
|
||||
-->
|
||||
</layout>
|
||||
</appender>
|
||||
|
||||
<appender name="ASYNCCOMPUTE" class="org.apache.log4j.AsyncAppender">
|
||||
<appender-ref ref="COMPUTEFILE" />
|
||||
</appender>
|
||||
|
||||
<appender name="ASYNCSSH" class="org.apache.log4j.AsyncAppender">
|
||||
<appender-ref ref="SSHFILE" />
|
||||
</appender>
|
||||
|
||||
<appender name="ASYNC" class="org.apache.log4j.AsyncAppender">
|
||||
<appender-ref ref="FILE" />
|
||||
</appender>
|
||||
|
||||
<appender name="ASYNCWIRE" class="org.apache.log4j.AsyncAppender">
|
||||
<appender-ref ref="WIREFILE" />
|
||||
</appender>
|
||||
|
||||
<!-- ================ -->
|
||||
<!-- Limit categories -->
|
||||
<!-- ================ -->
|
||||
|
||||
<category name="org.jclouds">
|
||||
<priority value="DEBUG" />
|
||||
<appender-ref ref="ASYNC" />
|
||||
</category>
|
||||
|
||||
<category name="jclouds.headers">
|
||||
<priority value="DEBUG" />
|
||||
<appender-ref ref="ASYNCWIRE" />
|
||||
</category>
|
||||
|
||||
<category name="jclouds.ssh">
|
||||
<priority value="DEBUG" />
|
||||
<appender-ref ref="ASYNCSSH" />
|
||||
</category>
|
||||
|
||||
<category name="jclouds.wire">
|
||||
<priority value="DEBUG" />
|
||||
<appender-ref ref="ASYNCWIRE" />
|
||||
</category>
|
||||
|
||||
<category name="jclouds.compute">
|
||||
<priority value="TRACE" />
|
||||
<appender-ref ref="ASYNCCOMPUTE" />
|
||||
</category>
|
||||
<!-- ======================= -->
|
||||
<!-- Setup the Root category -->
|
||||
<!-- ======================= -->
|
||||
|
||||
<root>
|
||||
<priority value="WARN" />
|
||||
</root>
|
||||
|
||||
</log4j:configuration>
|
|
@ -0,0 +1,237 @@
|
|||
<VApp xmlns="http://www.vmware.com/vcloud/v1" xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1" xmlns:vssd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData" xmlns:rasd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" deployed="true" status="4" name="customize-750" type="application/vnd.vmware.vcloud.vApp+xml" href="https://1.1.1.1/api/v1.0/vApp/vapp-1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2.22.0/CIM_VirtualSystemSettingData.xsd http://schemas.dmtf.org/ovf/envelope/1 http://schemas.dmtf.org/ovf/envelope/1/dsp8023_1.1.0.xsd http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2.22.0/CIM_ResourceAllocationSettingData.xsd http://www.vmware.com/vcloud/v1 http://1.1.1.1/api/v1.0/schema/master.xsd">
|
||||
<Link rel="power:powerOff" href="https://1.1.1.1/api/v1.0/vApp/vapp-1/power/action/powerOff"/>
|
||||
<Link rel="power:reboot" href="https://1.1.1.1/api/v1.0/vApp/vapp-1/power/action/reboot"/>
|
||||
<Link rel="power:reset" href="https://1.1.1.1/api/v1.0/vApp/vapp-1/power/action/reset"/>
|
||||
<Link rel="power:shutdown" href="https://1.1.1.1/api/v1.0/vApp/vapp-1/power/action/shutdown"/>
|
||||
<Link rel="power:suspend" href="https://1.1.1.1/api/v1.0/vApp/vapp-1/power/action/suspend"/>
|
||||
<Link rel="deploy" type="application/vnd.vmware.vcloud.deployVAppParams+xml" href="https://1.1.1.1/api/v1.0/vApp/vapp-1/action/deploy"/>
|
||||
<Link rel="undeploy" type="application/vnd.vmware.vcloud.undeployVAppParams+xml" href="https://1.1.1.1/api/v1.0/vApp/vapp-98934665/action/undeploy"/>
|
||||
<Link rel="down" type="application/vnd.vmware.vcloud.controlAccess+xml" href="https://1.1.1.1/api/v1.0/vApp/vapp-1/controlAccess/"/>
|
||||
<Link rel="controlAccess" type="application/vnd.vmware.vcloud.controlAccess+xml" href="https://1.1.1.1/api/v1.0/vApp/vapp-1/action/controlAccess"/>
|
||||
<Link rel="up" type="application/vnd.vmware.vcloud.vdc+xml" href="https://1.1.1.1/api/v1.0/vdc/1"/>
|
||||
<Link rel="edit" type="application/vnd.vmware.vcloud.vApp+xml" href="https://1.1.1.1/api/v1.0/vApp/vapp-1"/>
|
||||
<LeaseSettingsSection type="application/vnd.vmware.vcloud.leaseSettingsSection+xml" href="https://1.1.1.1/api/v1.0/vApp/vapp-1/leaseSettingsSection/" ovf:required="false">
|
||||
<ovf:Info>Lease settings section</ovf:Info>
|
||||
<Link rel="edit" type="application/vnd.vmware.vcloud.leaseSettingsSection+xml" href="https://1.1.1.1/api/v1.0/vApp/vapp-1/leaseSettingsSection/"/>
|
||||
<DeploymentLeaseInSeconds>0</DeploymentLeaseInSeconds>
|
||||
<StorageLeaseInSeconds>7776000</StorageLeaseInSeconds>
|
||||
</LeaseSettingsSection>
|
||||
<ovf:StartupSection xmlns:vcloud="http://www.vmware.com/vcloud/v1" vcloud:href="https://1.1.1.1/api/v1.0/vApp/vapp-1/startupSection/" vcloud:type="application/vnd.vmware.vcloud.startupSection+xml">
|
||||
<ovf:Info>VApp startup section</ovf:Info>
|
||||
<ovf:Item ovf:stopDelay="0" ovf:stopAction="powerOff" ovf:startDelay="0" ovf:startAction="powerOn" ovf:order="0" ovf:id="Centos-5.5_x64"/>
|
||||
<Link rel="edit" type="application/vnd.vmware.vcloud.startupSection+xml" href="https://1.1.1.1/api/v1.0/vApp/vapp-1/startupSection/"/>
|
||||
</ovf:StartupSection>
|
||||
<ovf:NetworkSection xmlns:vcloud="http://www.vmware.com/vcloud/v1" vcloud:href="https://1.1.1.1/api/v1.0/vApp/vapp-1/networkSection/" vcloud:type="application/vnd.vmware.vcloud.networkSection+xml">
|
||||
<ovf:Info>The list of logical networks</ovf:Info>
|
||||
<ovf:Network ovf:name="none">
|
||||
<ovf:Description/>
|
||||
</ovf:Network>
|
||||
<ovf:Network ovf:name="none">
|
||||
<ovf:Description>This is a special place-holder used for disconnected network interfaces.</ovf:Description>
|
||||
</ovf:Network>
|
||||
</ovf:NetworkSection> <NetworkConfigSection type="application/vnd.vmware.vcloud.networkConfigSection+xml" href="https://1.1.1.1/api/v1.0/vApp/vapp
|
||||
-1/networkConfigSection/" ovf:required="false">
|
||||
<ovf:Info>The configuration parameters for logical networks</ovf:Info>
|
||||
<Link rel="edit" type="application/vnd.vmware.vcloud.networkConfigSection+xml" href="https://1.1.1.1/api/v1.0/vApp/vapp-1/networkConfigSection/"/>
|
||||
<NetworkConfig networkName="none">
|
||||
<Description/>
|
||||
<Configuration>
|
||||
<IpScope>
|
||||
<IsInherited>true</IsInherited>
|
||||
<Gateway>172.16.7.1</Gateway>
|
||||
<Netmask>255.255.255.0</Netmask>
|
||||
<Dns1>208.95.232.10</Dns1>
|
||||
<Dns2>208.95.232.11</Dns2>
|
||||
<IpRanges>
|
||||
<IpRange>
|
||||
<StartAddress>172.16.7.230</StartAddress>
|
||||
<EndAddress>172.16.7.239</EndAddress>
|
||||
</IpRange>
|
||||
</IpRanges>
|
||||
</IpScope>
|
||||
<ParentNetwork type="application/vnd.vmware.vcloud.network+xml" name="Direct" href="https://1.1.1.1/api/v1.0/network/282371363"/>
|
||||
<FenceMode>bridged</FenceMode>
|
||||
<Features>
|
||||
<DhcpService>
|
||||
<IsEnabled>false</IsEnabled>
|
||||
<DefaultLeaseTime>3600</DefaultLeaseTime>
|
||||
<MaxLeaseTime>7200</MaxLeaseTime>
|
||||
<IpRange>
|
||||
<StartAddress>172.16.7.2</StartAddress>
|
||||
<EndAddress>172.16.7.229</EndAddress>
|
||||
</IpRange>
|
||||
</DhcpService>
|
||||
<FirewallService>
|
||||
<IsEnabled>true</IsEnabled>
|
||||
</FirewallService>
|
||||
<NatService>
|
||||
<IsEnabled>true</IsEnabled>
|
||||
<NatType>ipTranslation</NatType>
|
||||
<Policy>allowTraffic</Policy>
|
||||
</NatService>
|
||||
</Features>
|
||||
</Configuration>
|
||||
<IsDeployed>true</IsDeployed>
|
||||
</NetworkConfig>
|
||||
<NetworkConfig networkName="none">
|
||||
<Description>This is a special place-holder used for disconnected network interfaces.</Description>
|
||||
<Configuration>
|
||||
<IpScope>
|
||||
<IsInherited>false</IsInherited>
|
||||
<Gateway>196.254.254.254</Gateway>
|
||||
<Netmask>255.255.0.0</Netmask>
|
||||
<Dns1>196.254.254.254</Dns1>
|
||||
</IpScope>
|
||||
<FenceMode>isolated</FenceMode>
|
||||
</Configuration>
|
||||
<IsDeployed>false</IsDeployed>
|
||||
</NetworkConfig>
|
||||
</NetworkConfigSection>
|
||||
<Children>
|
||||
<Vm deployed="true" status="4" name="Centos-5.5_x64" type="application/vnd.vmware.vcloud.vm+xml" href="https://1.1.1.1/api/v1.0/vApp/vm-1">
|
||||
<Link rel="power:powerOff" href="https://1.1.1.1/api/v1.0/vApp/vm-1/power/action/powerOff"/>
|
||||
<Link rel="power:reboot" href="https://1.1.1.1/api/v1.0/vApp/vm-1/power/action/reboot"/>
|
||||
<Link rel="power:reset" href="https://1.1.1.1/api/v1.0/vApp/vm-1/power/action/reset"/>
|
||||
<Link rel="power:shutdown" href="https://1.1.1.1/api/v1.0/vApp/vm-1/power/action/shutdown"/>
|
||||
<Link rel="power:suspend" href="https://1.1.1.1/api/v1.0/vApp/vm-1/power/action/suspend"/>
|
||||
<Link rel="undeploy" type="application/vnd.vmware.vcloud.undeployVAppParams+xml" href="https://1.1.1.1/api/v1.0/vApp/vm-1/action/undeploy"/>
|
||||
<Link rel="up" type="application/vnd.vmware.vcloud.vApp+xml" href="https://1.1.1.1/api/v1.0/vApp/vapp-1"/>
|
||||
<Link rel="edit" type="application/vnd.vmware.vcloud.vm+xml" href="https://1.1.1.1/api/v1.0/vApp/vm-1"/>
|
||||
<Link rel="screen:thumbnail" href="https://1.1.1.1/api/v1.0/vApp/vm-1/screen"/>
|
||||
<Link rel="screen:acquireTicket" href="https://1.1.1.1/api/v1.0/vApp/vm-1/screen/action/acquireTicket"/>
|
||||
<Link rel="media:insertMedia" type="application/vnd.vmware.vcloud.mediaInsertOrEjectParams+xml" href="https://1.1.1.1/api/v1.0/vApp/vm-1/media/action/insertMedia"/>
|
||||
<Link rel="media:ejectMedia" type="application/vnd.vmware.vcloud.mediaInsertOrEjectParams+xml" href="https://1.1.1.1/api/v1.0/vApp/vm-1/media/action/ejectMedia"/>
|
||||
<Description/>
|
||||
<ovf:VirtualHardwareSection xmlns:vcloud="http://www.vmware.com/vcloud/v1" vcloud:href="https://1.1.1.1/api/v1.0/vApp/vm-1/virtualHardwareSection/" vcloud:type="application/vnd.vmware.vcloud.virtualHardwareSection+xml">
|
||||
<ovf:Info>Virtual hardware requirements</ovf:Info>
|
||||
<ovf:System>
|
||||
<vssd:ElementName>Virtual Hardware Family</vssd:ElementName>
|
||||
<vssd:InstanceID>0</vssd:InstanceID>
|
||||
<vssd:VirtualSystemIdentifier>Centos-5.5_x64</vssd:VirtualSystemIdentifier>
|
||||
<vssd:VirtualSystemType>vmx-07</vssd:VirtualSystemType>
|
||||
</ovf:System>
|
||||
<ovf:Item>
|
||||
<rasd:Address>00:50:56:01:02:38</rasd:Address>
|
||||
<rasd:AddressOnParent>0</rasd:AddressOnParent>
|
||||
<rasd:AutomaticAllocation>false</rasd:AutomaticAllocation>
|
||||
<rasd:Connection vcloud:primaryNetworkConnection="true" vcloud:ipAddressingMode="NONE">none</rasd:Connection>
|
||||
<rasd:Description>PCNet32 ethernet adapter</rasd:Description>
|
||||
<rasd:ElementName>Network adapter 0</rasd:ElementName>
|
||||
<rasd:InstanceID>1</rasd:InstanceID>
|
||||
<rasd:ResourceSubType>PCNet32</rasd:ResourceSubType>
|
||||
<rasd:ResourceType>10</rasd:ResourceType>
|
||||
</ovf:Item>
|
||||
<ovf:Item>
|
||||
<rasd:Address>0</rasd:Address>
|
||||
<rasd:Description>SCSI Controller</rasd:Description>
|
||||
<rasd:ElementName>SCSI Controller 0</rasd:ElementName>
|
||||
<rasd:InstanceID>2</rasd:InstanceID>
|
||||
<rasd:ResourceSubType>lsilogic</rasd:ResourceSubType>
|
||||
<rasd:ResourceType>6</rasd:ResourceType>
|
||||
</ovf:Item>
|
||||
<ovf:Item>
|
||||
<rasd:AddressOnParent>0</rasd:AddressOnParent>
|
||||
<rasd:Description>Hard disk</rasd:Description>
|
||||
<rasd:ElementName>Hard disk 1</rasd:ElementName>
|
||||
<rasd:HostResource vcloud:capacity="15360" vcloud:busType="6" vcloud:busSubType="lsilogic"/>
|
||||
<rasd:InstanceID>2000</rasd:InstanceID>
|
||||
<rasd:Parent>2</rasd:Parent>
|
||||
<rasd:ResourceType>17</rasd:ResourceType>
|
||||
</ovf:Item>
|
||||
<ovf:Item>
|
||||
<rasd:Address>0</rasd:Address>
|
||||
<rasd:Description>IDE Controller</rasd:Description>
|
||||
<rasd:ElementName>IDE Controller 0</rasd:ElementName>
|
||||
<rasd:InstanceID>3</rasd:InstanceID>
|
||||
<rasd:ResourceType>5</rasd:ResourceType>
|
||||
</ovf:Item>
|
||||
<ovf:Item>
|
||||
<rasd:AddressOnParent>0</rasd:AddressOnParent>
|
||||
<rasd:AutomaticAllocation>false</rasd:AutomaticAllocation>
|
||||
<rasd:Description>CD/DVD Drive</rasd:Description>
|
||||
<rasd:ElementName>CD/DVD Drive 1</rasd:ElementName>
|
||||
<rasd:HostResource/>
|
||||
<rasd:InstanceID>3002</rasd:InstanceID>
|
||||
<rasd:Parent>3</rasd:Parent>
|
||||
<rasd:ResourceType>15</rasd:ResourceType>
|
||||
</ovf:Item>
|
||||
<ovf:Item>
|
||||
<rasd:AddressOnParent>0</rasd:AddressOnParent>
|
||||
<rasd:AutomaticAllocation>false</rasd:AutomaticAllocation>
|
||||
<rasd:Description>Floppy Drive</rasd:Description>
|
||||
<rasd:ElementName>Floppy Drive 1</rasd:ElementName>
|
||||
<rasd:HostResource/>
|
||||
<rasd:InstanceID>8000</rasd:InstanceID>
|
||||
<rasd:ResourceType>14</rasd:ResourceType>
|
||||
</ovf:Item>
|
||||
<ovf:Item vcloud:href="https://1.1.1.1/api/v1.0/vApp/vm-1/virtualHardwareSection/cpu" vcloud:type="application/vnd.vmware.vcloud.rasdItem+xml">
|
||||
<rasd:AllocationUnits>hertz * 10^6</rasd:AllocationUnits>
|
||||
<rasd:Description>Number of Virtual CPUs</rasd:Description>
|
||||
<rasd:ElementName>1 virtual CPU(s)</rasd:ElementName>
|
||||
<rasd:InstanceID>4</rasd:InstanceID>
|
||||
<rasd:Reservation>0</rasd:Reservation>
|
||||
<rasd:ResourceType>3</rasd:ResourceType>
|
||||
<rasd:VirtualQuantity>1</rasd:VirtualQuantity>
|
||||
<rasd:Weight>0</rasd:Weight>
|
||||
<Link rel="edit" type="application/vnd.vmware.vcloud.rasdItem+xml" href="https://1.1.1.1/api/v1.0/vApp/vm-1/virtualHardwareSection/cpu"/>
|
||||
</ovf:Item>
|
||||
<ovf:Item vcloud:href="https://1.1.1.1/api/v1.0/vApp/vm-1/virtualHardwareSection/memory" vcloud:type="application/vnd.vmware.vcloud.rasdItem+xml">
|
||||
<rasd:AllocationUnits>byte * 2^20</rasd:AllocationUnits>
|
||||
<rasd:Description>Memory Size</rasd:Description>
|
||||
<rasd:ElementName>2048 MB of memory</rasd:ElementName>
|
||||
<rasd:InstanceID>5</rasd:InstanceID>
|
||||
<rasd:Reservation>0</rasd:Reservation>
|
||||
<rasd:ResourceType>4</rasd:ResourceType>
|
||||
<rasd:VirtualQuantity>2048</rasd:VirtualQuantity>
|
||||
<rasd:Weight>0</rasd:Weight>
|
||||
<Link rel="edit" type="application/vnd.vmware.vcloud.rasdItem+xml" href="https://1.1.1.1/api/v1.0/vApp/vm-1/virtualHardwareSection/memory"/>
|
||||
</ovf:Item>
|
||||
<Link rel="edit" type="application/vnd.vmware.vcloud.virtualHardwareSection+xml" href="https://1.1.1.1/api/v1.0/vApp/vm-1/virtualHardwareSection/"/>
|
||||
<Link rel="down" type="application/vnd.vmware.vcloud.rasdItem+xml" href="https://1.1.1.1/api/v1.0/vApp/vm-1/virtualHardwareSection/cpu"/>
|
||||
<Link rel="edit" type="application/vnd.vmware.vcloud.rasdItem+xml" href="https://1.1.1.1/api/v1.0/vApp/vm-1/virtualHardwareSection/cpu"/>
|
||||
<Link rel="down" type="application/vnd.vmware.vcloud.rasdItem+xml" href="https://1.1.1.1/api/v1.0/vApp/vm-1/virtualHardwareSection/memory"/>
|
||||
<Link rel="edit" type="application/vnd.vmware.vcloud.rasdItem+xml" href="https://1.1.1.1/api/v1.0/vApp/vm-1/virtualHardwareSection/memory"/>
|
||||
<Link rel="down" type="application/vnd.vmware.vcloud.rasdItemsList+xml" href="https://1.1.1.1/api/v1.0/vApp/vm-1/virtualHardwareSection/disks"/>
|
||||
<Link rel="edit" type="application/vnd.vmware.vcloud.rasdItemsList+xml" href="https://1.1.1.1/api/v1.0/vApp/vm-1/virtualHardwareSection/disks"/>
|
||||
<Link rel="down" type="application/vnd.vmware.vcloud.rasdItemsList+xml" href="https://1.1.1.1/api/v1.0/vApp/vm-1/virtualHardwareSection/media"/>
|
||||
<Link rel="down" type="application/vnd.vmware.vcloud.rasdItemsList+xml" href="https://1.1.1.1/api/v1.0/vApp/vm-1/virtualHardwareSection/networkCards"/>
|
||||
<Link rel="edit" type="application/vnd.vmware.vcloud.rasdItemsList+xml" href="https://1.1.1.1/api/v1.0/vApp/vm-1/virtualHardwareSection/networkCards"/>
|
||||
</ovf:VirtualHardwareSection>
|
||||
<ovf:OperatingSystemSection xmlns:vcloud="http://www.vmware.com/vcloud/v1" xmlns:vmw="http://www.vmware.com/schema/ovf" ovf:id="80" vcloud:href="https://1.1.1.1/api/v1.0/vApp/vm-1/operatingSystemSection/" vcloud:type="application/vnd.vmware.vcloud.operatingSystemSection+xml" vmw:osType="rhel5_64Guest">
|
||||
<ovf:Info>Specifies the operating system installed</ovf:Info>
|
||||
<ovf:Description>Red Hat Enterprise Linux 5 (64-bit)</ovf:Description>
|
||||
<Link rel="edit" type="application/vnd.vmware.vcloud.operatingSystemSection+xml" href="https://1.1.1.1/api/v1.0/vApp/vm-1/operatingSystemSection/"/>
|
||||
</ovf:OperatingSystemSection>
|
||||
<NetworkConnectionSection type="application/vnd.vmware.vcloud.networkConnectionSection+xml" href="https://1.1.1.1/api/v1.0/vApp/vm-1/networkConnectionSection/" ovf:required="false">
|
||||
<ovf:Info>Specifies the available VM network connections</ovf:Info>
|
||||
<PrimaryNetworkConnectionIndex>0</PrimaryNetworkConnectionIndex>
|
||||
<NetworkConnection network="none">
|
||||
<NetworkConnectionIndex>0</NetworkConnectionIndex>
|
||||
<IsConnected>false</IsConnected>
|
||||
<MACAddress>00:50:56:01:02:38</MACAddress>
|
||||
<IpAddressAllocationMode>NONE</IpAddressAllocationMode>
|
||||
</NetworkConnection>
|
||||
<Link rel="edit" type="application/vnd.vmware.vcloud.networkConnectionSection+xml" href="https://1.1.1.1/api/v1.0/vApp/vm-1/networkConnectionSection/"/>
|
||||
</NetworkConnectionSection>
|
||||
<GuestCustomizationSection type="application/vnd.vmware.vcloud.guestCustomizationSection+xml" href="https://1.1.1.1/api/v1.0/vApp/vm-1/guestCustomizationSection/" ovf:required="false">
|
||||
<ovf:Info>Specifies Guest OS Customization Settings</ovf:Info>
|
||||
<Enabled>true</Enabled>
|
||||
<ChangeSid>false</ChangeSid>
|
||||
<VirtualMachineId>1</VirtualMachineId>
|
||||
<JoinDomainEnabled>false</JoinDomainEnabled>
|
||||
<UseOrgSettings>false</UseOrgSettings>
|
||||
<AdminPasswordEnabled>true</AdminPasswordEnabled>
|
||||
<AdminPasswordAuto>true</AdminPasswordAuto>
|
||||
<AdminPassword>secret</AdminPassword>
|
||||
<ResetPasswordRequired>false</ResetPasswordRequired>
|
||||
<CustomizationScript>cat > /root/foo.txt<<EOF
|
||||
I love candy
|
||||
EOF
|
||||
</CustomizationScript>
|
||||
<ComputerName>Centos-5.5_x64</ComputerName>
|
||||
<Link rel="edit" type="application/vnd.vmware.vcloud.guestCustomizationSection+xml" href="https://1.1.1.1/api/v1.0/vApp/vm-1/guestCustomizationSection/"/>
|
||||
</GuestCustomizationSection>
|
||||
<VAppScopedLocalId>Centos-5.5_x64</VAppScopedLocalId>
|
||||
</Vm>
|
||||
</Children>
|
||||
</VApp>
|
|
@ -0,0 +1,227 @@
|
|||
<VApp xmlns="http://www.vmware.com/vcloud/v1" xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1" xmlns:vssd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData" xmlns:rasd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" deployed="true" status="4" name="my-appExample" type="application/vnd.vmware.vcloud.vApp+xml" href="https://1.1.1.1/api/v1.0/vApp/vapp-1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2.22.0/CIM_VirtualSystemSettingData.xsd http://schemas.dmtf.org/ovf/envelope/1 http://schemas.dmtf.org/ovf/envelope/1/dsp8023_1.1.0.xsd http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2.22.0/CIM_ResourceAllocationSettingData.xsd http://www.vmware.com/vcloud/v1 http://1.1.1.1/api/v1.0/schema/master.xsd">
|
||||
<Link rel="power:powerOff" href="https://1.1.1.1/api/v1.0/vApp/vapp-1/power/action/powerOff"/>
|
||||
<Link rel="power:reboot" href="https://1.1.1.1/api/v1.0/vApp/vapp-1/power/action/reboot"/>
|
||||
<Link rel="power:reset" href="https://1.1.1.1/api/v1.0/vApp/vapp-1/power/action/reset"/>
|
||||
<Link rel="power:shutdown" href="https://1.1.1.1/api/v1.0/vApp/vapp-1/power/action/shutdown"/>
|
||||
<Link rel="power:suspend" href="https://1.1.1.1/api/v1.0/vApp/vapp-1/power/action/suspend"/>
|
||||
<Link rel="deploy" type="application/vnd.vmware.vcloud.deployVAppParams+xml" href="https://1.1.1.1/api/v1.0/vApp/vapp-1/action/deploy"/>
|
||||
<Link rel="undeploy" type="application/vnd.vmware.vcloud.undeployVAppParams+xml" href="https://1.1.1.1/api/v1.0/vApp/vapp-1/action/undeploy"/>
|
||||
<Link rel="down" type="application/vnd.vmware.vcloud.controlAccess+xml" href="https://1.1.1.1/api/v1.0/vApp/vapp-1/controlAccess/"/>
|
||||
<Link rel="controlAccess" type="application/vnd.vmware.vcloud.controlAccess+xml" href="https://1.1.1.1/api/v1.0/vApp/vapp-1/action/controlAccess"/>
|
||||
<Link rel="up" type="application/vnd.vmware.vcloud.vdc+xml" href="https://1.1.1.1/api/v1.0/vdc/1"/>
|
||||
<Link rel="edit" type="application/vnd.vmware.vcloud.vApp+xml" href="https://1.1.1.1/api/v1.0/vApp/vapp-1"/>
|
||||
<Description/>
|
||||
<LeaseSettingsSection type="application/vnd.vmware.vcloud.leaseSettingsSection+xml" href="https://1.1.1.1/api/v1.0/vApp/vapp-1/leaseSettingsSection/" ovf:required="false">
|
||||
<ovf:Info>Lease settings section</ovf:Info>
|
||||
<Link rel="edit" type="application/vnd.vmware.vcloud.leaseSettingsSection+xml" href="https://1.1.1.1/api/v1.0/vApp/vapp-1/leaseSettingsSection/"/>
|
||||
<DeploymentLeaseInSeconds>0</DeploymentLeaseInSeconds>
|
||||
<StorageLeaseInSeconds>0</StorageLeaseInSeconds>
|
||||
</LeaseSettingsSection>
|
||||
<ovf:StartupSection xmlns:vcloud="http://www.vmware.com/vcloud/v1" vcloud:href="https://1.1.1.1/api/v1.0/vApp/vapp-1/startupSection/" vcloud:type="application/vnd.vmware.vcloud.startupSection+xml">
|
||||
<ovf:Info>VApp startup section</ovf:Info>
|
||||
<ovf:Item ovf:stopDelay="0" ovf:stopAction="powerOff" ovf:startDelay="0" ovf:startAction="powerOn" ovf:order="0" ovf:id="my-app"/>
|
||||
<Link rel="edit" type="application/vnd.vmware.vcloud.startupSection+xml" href="https://1.1.1.1/api/v1.0/vApp/vapp-1/startupSection/"/>
|
||||
</ovf:StartupSection>
|
||||
<ovf:NetworkSection xmlns:vcloud="http://www.vmware.com/vcloud/v1" vcloud:href="https://1.1.1.1/api/v1.0/vApp/vapp-1/networkSection/" vcloud:type="application/vnd.vmware.vcloud.networkSection+xml">
|
||||
<ovf:Info>The list of logical networks</ovf:Info>
|
||||
<ovf:Network ovf:name="Direct">
|
||||
<ovf:Description/>
|
||||
</ovf:Network>
|
||||
</ovf:NetworkSection>
|
||||
<NetworkConfigSection type="application/vnd.vmware.vcloud.networkConfigSection+xml" href="https://1.1.1.1/api/v1.0/vApp/vapp-1/networkConfigSection/" ovf:required="false">
|
||||
<ovf:Info>The configuration parameters for logical networks</ovf:Info>
|
||||
<Link rel="edit" type="application/vnd.vmware.vcloud.networkConfigSection+xml" href="https://1.1.1.1/api/v1.0/vApp/vapp-1/networkConfigSection/"/>
|
||||
<NetworkConfig networkName="Direct">
|
||||
<Description/>
|
||||
<Configuration>
|
||||
<IpScope>
|
||||
<IsInherited>true</IsInherited>
|
||||
<Gateway>172.16.7.1</Gateway>
|
||||
<Netmask>255.255.255.0</Netmask>
|
||||
<Dns1>1.1.1.2</Dns1>
|
||||
<Dns2>1.1.1.3</Dns2>
|
||||
<IpRanges>
|
||||
<IpRange>
|
||||
<StartAddress>172.16.7.230</StartAddress>
|
||||
<EndAddress>172.16.7.239</EndAddress>
|
||||
</IpRange>
|
||||
</IpRanges>
|
||||
</IpScope>
|
||||
<ParentNetwork type="application/vnd.vmware.vcloud.network+xml" name="Direct" href="https://1.1.1.1/api/v1.0/network/282371363"/>
|
||||
<FenceMode>bridged</FenceMode>
|
||||
<Features>
|
||||
<DhcpService>
|
||||
<IsEnabled>false</IsEnabled>
|
||||
<DefaultLeaseTime>3600</DefaultLeaseTime>
|
||||
<MaxLeaseTime>7200</MaxLeaseTime>
|
||||
<IpRange>
|
||||
<StartAddress>172.16.7.2</StartAddress>
|
||||
<EndAddress>172.16.7.229</EndAddress>
|
||||
</IpRange>
|
||||
</DhcpService>
|
||||
<FirewallService>
|
||||
<IsEnabled>true</IsEnabled>
|
||||
</FirewallService>
|
||||
<NatService>
|
||||
<IsEnabled>true</IsEnabled>
|
||||
<NatType>ipTranslation</NatType>
|
||||
<Policy>allowTraffic</Policy>
|
||||
<NatRule>
|
||||
<OneToOneVmRule>
|
||||
<MappingMode>automatic</MappingMode>
|
||||
<VAppScopedVmId>100c208b-4f43-40bb-98d6-a046f6e48c3a</VAppScopedVmId>
|
||||
<VmNicId>0</VmNicId>
|
||||
</OneToOneVmRule>
|
||||
</NatRule>
|
||||
</NatService>
|
||||
</Features>
|
||||
</Configuration>
|
||||
<IsDeployed>true</IsDeployed>
|
||||
</NetworkConfig>
|
||||
</NetworkConfigSection>
|
||||
<Children>
|
||||
<Vm deployed="true" status="4" name="my-app" type="application/vnd.vmware.vcloud.vm+xml" href="https://1.1.1.1/api/v1.0/vApp/vm-1">
|
||||
<Link rel="power:powerOff" href="https://1.1.1.1/api/v1.0/vApp/vm-1/power/action/powerOff"/>
|
||||
<Link rel="power:reboot" href="https://1.1.1.1/api/v1.0/vApp/vm-1/power/action/reboot"/>
|
||||
<Link rel="power:reset" href="https://1.1.1.1/api/v1.0/vApp/vm-1/power/action/reset"/>
|
||||
<Link rel="power:shutdown" href="https://1.1.1.1/api/v1.0/vApp/vm-1/power/action/shutdown"/>
|
||||
<Link rel="power:suspend" href="https://1.1.1.1/api/v1.0/vApp/vm-1/power/action/suspend"/>
|
||||
<Link rel="undeploy" type="application/vnd.vmware.vcloud.undeployVAppParams+xml" href="https://1.1.1.1/api/v1.0/vApp/vm-1/action/undeploy"/>
|
||||
<Link rel="up" type="application/vnd.vmware.vcloud.vApp+xml" href="https://1.1.1.1/api/v1.0/vApp/vapp-1"/>
|
||||
<Link rel="edit" type="application/vnd.vmware.vcloud.vm+xml" href="https://1.1.1.1/api/v1.0/vApp/vm-1"/>
|
||||
<Link rel="screen:thumbnail" href="https://1.1.1.1/api/v1.0/vApp/vm-1/screen"/>
|
||||
<Link rel="screen:acquireTicket" href="https://1.1.1.1/api/v1.0/vApp/vm-1/screen/action/acquireTicket"/>
|
||||
<Link rel="media:insertMedia" type="application/vnd.vmware.vcloud.mediaInsertOrEjectParams+xml" href="https://1.1.1.1/api/v1.0/vApp/vm-1/media/action/insertMedia"/>
|
||||
<Link rel="media:ejectMedia" type="application/vnd.vmware.vcloud.mediaInsertOrEjectParams+xml" href="https://1.1.1.1/api/v1.0/vApp/vm-1/media/action/ejectMedia"/>
|
||||
<Description/>
|
||||
<ovf:VirtualHardwareSection xmlns:vcloud="http://www.vmware.com/vcloud/v1" vcloud:href="https://1.1.1.1/api/v1.0/vApp/vm-1/virtualHardwareSection/" vcloud:type="application/vnd.vmware.vcloud.virtualHardwareSection+xml">
|
||||
<ovf:Info>Virtual hardware requirements</ovf:Info>
|
||||
<ovf:System>
|
||||
<vssd:ElementName>Virtual Hardware Family</vssd:ElementName>
|
||||
<vssd:InstanceID>0</vssd:InstanceID>
|
||||
<vssd:VirtualSystemIdentifier>my-app</vssd:VirtualSystemIdentifier>
|
||||
<vssd:VirtualSystemType>vmx-07</vssd:VirtualSystemType>
|
||||
</ovf:System>
|
||||
<ovf:Item>
|
||||
<rasd:Address>00:50:56:01:02:33</rasd:Address>
|
||||
<rasd:AddressOnParent>0</rasd:AddressOnParent>
|
||||
<rasd:AutomaticAllocation>true</rasd:AutomaticAllocation>
|
||||
<rasd:Connection vcloud:ipAddress="172.16.7.230" vcloud:primaryNetworkConnection="true" vcloud:ipAddressingMode="POOL">Direct</rasd:Connection>
|
||||
<rasd:Description>PCNet32 ethernet adapter</rasd:Description>
|
||||
<rasd:ElementName>Network adapter 0</rasd:ElementName>
|
||||
<rasd:InstanceID>1</rasd:InstanceID>
|
||||
<rasd:ResourceSubType>PCNet32</rasd:ResourceSubType>
|
||||
<rasd:ResourceType>10</rasd:ResourceType>
|
||||
</ovf:Item>
|
||||
<ovf:Item>
|
||||
<rasd:Address>0</rasd:Address>
|
||||
<rasd:Description>SCSI Controller</rasd:Description>
|
||||
<rasd:ElementName>SCSI Controller 0</rasd:ElementName>
|
||||
<rasd:InstanceID>2</rasd:InstanceID>
|
||||
<rasd:ResourceSubType>lsilogic</rasd:ResourceSubType>
|
||||
<rasd:ResourceType>6</rasd:ResourceType>
|
||||
</ovf:Item>
|
||||
<ovf:Item>
|
||||
<rasd:AddressOnParent>0</rasd:AddressOnParent>
|
||||
<rasd:Description>Hard disk</rasd:Description>
|
||||
<rasd:ElementName>Hard disk 1</rasd:ElementName>
|
||||
<rasd:HostResource vcloud:capacity="15360" vcloud:busType="6" vcloud:busSubType="lsilogic"/>
|
||||
<rasd:InstanceID>2000</rasd:InstanceID>
|
||||
<rasd:Parent>2</rasd:Parent>
|
||||
<rasd:ResourceType>17</rasd:ResourceType>
|
||||
</ovf:Item>
|
||||
<ovf:Item>
|
||||
<rasd:Address>0</rasd:Address>
|
||||
<rasd:Description>IDE Controller</rasd:Description>
|
||||
<rasd:ElementName>IDE Controller 0</rasd:ElementName>
|
||||
<rasd:InstanceID>3</rasd:InstanceID>
|
||||
<rasd:ResourceType>5</rasd:ResourceType>
|
||||
</ovf:Item>
|
||||
<ovf:Item>
|
||||
<rasd:AddressOnParent>0</rasd:AddressOnParent>
|
||||
<rasd:AutomaticAllocation>false</rasd:AutomaticAllocation>
|
||||
<rasd:Description>CD/DVD Drive</rasd:Description>
|
||||
<rasd:ElementName>CD/DVD Drive 1</rasd:ElementName>
|
||||
<rasd:HostResource/>
|
||||
<rasd:InstanceID>3002</rasd:InstanceID>
|
||||
<rasd:Parent>3</rasd:Parent>
|
||||
<rasd:ResourceType>15</rasd:ResourceType>
|
||||
</ovf:Item>
|
||||
<ovf:Item>
|
||||
<rasd:AddressOnParent>0</rasd:AddressOnParent>
|
||||
<rasd:AutomaticAllocation>false</rasd:AutomaticAllocation>
|
||||
<rasd:Description>Floppy Drive</rasd:Description>
|
||||
<rasd:ElementName>Floppy Drive 1</rasd:ElementName>
|
||||
<rasd:HostResource/>
|
||||
<rasd:InstanceID>8000</rasd:InstanceID>
|
||||
<rasd:ResourceType>14</rasd:ResourceType>
|
||||
</ovf:Item>
|
||||
<ovf:Item vcloud:href="https://1.1.1.1/api/v1.0/vApp/vm-1/virtualHardwareSection/cpu" vcloud:type="application/vnd.vmware.vcloud.rasdItem+xml">
|
||||
<rasd:AllocationUnits>hertz * 10^6</rasd:AllocationUnits>
|
||||
<rasd:Description>Number of Virtual CPUs</rasd:Description>
|
||||
<rasd:ElementName>1 virtual CPU(s)</rasd:ElementName>
|
||||
<rasd:InstanceID>4</rasd:InstanceID>
|
||||
<rasd:Reservation>0</rasd:Reservation>
|
||||
<rasd:ResourceType>3</rasd:ResourceType>
|
||||
<rasd:VirtualQuantity>1</rasd:VirtualQuantity>
|
||||
<rasd:Weight>0</rasd:Weight>
|
||||
<Link rel="edit" type="application/vnd.vmware.vcloud.rasdItem+xml" href="https://1.1.1.1/api/v1.0/vApp/vm-1/virtualHardwareSection/cpu"/>
|
||||
</ovf:Item>
|
||||
<ovf:Item vcloud:href="https://1.1.1.1/api/v1.0/vApp/vm-1/virtualHardwareSection/memory" vcloud:type="application/vnd.vmware.vcloud.rasdItem+xml">
|
||||
<rasd:AllocationUnits>byte * 2^20</rasd:AllocationUnits>
|
||||
<rasd:Description>Memory Size</rasd:Description>
|
||||
<rasd:ElementName>2048 MB of memory</rasd:ElementName>
|
||||
<rasd:InstanceID>5</rasd:InstanceID>
|
||||
<rasd:Reservation>0</rasd:Reservation>
|
||||
<rasd:ResourceType>4</rasd:ResourceType>
|
||||
<rasd:VirtualQuantity>2048</rasd:VirtualQuantity>
|
||||
<rasd:Weight>0</rasd:Weight>
|
||||
<Link rel="edit" type="application/vnd.vmware.vcloud.rasdItem+xml" href="https://1.1.1.1/api/v1.0/vApp/vm-1/virtualHardwareSection/memory"/>
|
||||
</ovf:Item>
|
||||
<Link rel="edit" type="application/vnd.vmware.vcloud.virtualHardwareSection+xml" href="https://1.1.1.1/api/v1.0/vApp/vm-1/virtualHardwareSection/"/>
|
||||
<Link rel="down" type="application/vnd.vmware.vcloud.rasdItem+xml" href="https://1.1.1.1/api/v1.0/vApp/vm-1/virtualHardwareSection/cpu"/>
|
||||
<Link rel="edit" type="application/vnd.vmware.vcloud.rasdItem+xml" href="https://1.1.1.1/api/v1.0/vApp/vm-1/virtualHardwareSection/cpu"/>
|
||||
<Link rel="down" type="application/vnd.vmware.vcloud.rasdItem+xml" href="https://1.1.1.1/api/v1.0/vApp/vm-1/virtualHardwareSection/memory"/>
|
||||
<Link rel="edit" type="application/vnd.vmware.vcloud.rasdItem+xml" href="https://1.1.1.1/api/v1.0/vApp/vm-1/virtualHardwareSection/memory"/>
|
||||
<Link rel="down" type="application/vnd.vmware.vcloud.rasdItemsList+xml" href="https://1.1.1.1/api/v1.0/vApp/vm-1/virtualHardwareSection/disks"/>
|
||||
<Link rel="edit" type="application/vnd.vmware.vcloud.rasdItemsList+xml" href="https://1.1.1.1/api/v1.0/vApp/vm-1/virtualHardwareSection/disks"/>
|
||||
<Link rel="down" type="application/vnd.vmware.vcloud.rasdItemsList+xml" href="https://1.1.1.1/api/v1.0/vApp/vm-1/virtualHardwareSection/media"/>
|
||||
<Link rel="down" type="application/vnd.vmware.vcloud.rasdItemsList+xml" href="https://1.1.1.1/api/v1.0/vApp/vm-1/virtualHardwareSection/networkCards"/>
|
||||
<Link rel="edit" type="application/vnd.vmware.vcloud.rasdItemsList+xml" href="https://1.1.1.1/api/v1.0/vApp/vm-1/virtualHardwareSection/networkCards"/>
|
||||
</ovf:VirtualHardwareSection>
|
||||
<ovf:OperatingSystemSection xmlns:vcloud="http://www.vmware.com/vcloud/v1" xmlns:vmw="http://www.vmware.com/schema/ovf" ovf:id="80" vcloud:href="https://1.1.1.1/api/v1.0/vApp/vm-1/operatingSystemSection/" vcloud:type="application/vnd.vmware.vcloud.operatingSystemSection+xml" vmw:osType="rhel5_64Guest">
|
||||
<ovf:Info>Specifies the operating system installed</ovf:Info>
|
||||
<ovf:Description>Red Hat Enterprise Linux 5 (64-bit)</ovf:Description>
|
||||
<Link rel="edit" type="application/vnd.vmware.vcloud.operatingSystemSection+xml" href="https://1.1.1.1/api/v1.0/vApp/vm-1/operatingSystemSection/"/>
|
||||
</ovf:OperatingSystemSection>
|
||||
<NetworkConnectionSection type="application/vnd.vmware.vcloud.networkConnectionSection+xml" href="https://1.1.1.1/api/v1.0/vApp/vm-1/networkConnectionSection/" ovf:required="false">
|
||||
<ovf:Info>Specifies the available VM network connections</ovf:Info>
|
||||
<PrimaryNetworkConnectionIndex>0</PrimaryNetworkConnectionIndex>
|
||||
<NetworkConnection network="Direct">
|
||||
<NetworkConnectionIndex>0</NetworkConnectionIndex>
|
||||
<IpAddress>172.16.7.230</IpAddress>
|
||||
<IsConnected>true</IsConnected>
|
||||
<MACAddress>00:50:56:01:02:33</MACAddress>
|
||||
<IpAddressAllocationMode>POOL</IpAddressAllocationMode>
|
||||
</NetworkConnection>
|
||||
<Link rel="edit" type="application/vnd.vmware.vcloud.networkConnectionSection+xml" href="https://1.1.1.1/api/v1.0/vApp/vm-1/networkConnectionSection/"/>
|
||||
</NetworkConnectionSection>
|
||||
<GuestCustomizationSection type="application/vnd.vmware.vcloud.guestCustomizationSection+xml" href="https://1.1.1.1/api/v1.0/vApp/vm-1/guestCustomizationSection/" ovf:required="false">
|
||||
<ovf:Info>Specifies Guest OS Customization Settings</ovf:Info>
|
||||
<Enabled>true</Enabled>
|
||||
<ChangeSid>false</ChangeSid>
|
||||
<VirtualMachineId>1</VirtualMachineId>
|
||||
<JoinDomainEnabled>false</JoinDomainEnabled>
|
||||
<UseOrgSettings>false</UseOrgSettings>
|
||||
<AdminPasswordEnabled>true</AdminPasswordEnabled>
|
||||
<AdminPasswordAuto>true</AdminPasswordAuto>
|
||||
<AdminPassword>Favor</AdminPassword>
|
||||
<ResetPasswordRequired>false</ResetPasswordRequired>
|
||||
<CustomizationScript/>
|
||||
<ComputerName>my-app</ComputerName>
|
||||
<Link rel="edit" type="application/vnd.vmware.vcloud.guestCustomizationSection+xml" href="https://1.1.1.1/api/v1.0/vApp/vm-1/guestCustomizationSection/"/>
|
||||
</GuestCustomizationSection>
|
||||
<VAppScopedLocalId>100c208b-4f43-40bb-98d6-a046f6e48c3a</VAppScopedLocalId>
|
||||
</Vm>
|
||||
</Children>
|
||||
</VApp>
|
|
@ -36,7 +36,7 @@ public class VCloudComputeServiceContextModuleTest {
|
|||
for (Status state : EnumSet.allOf(Status.class).complementOf(
|
||||
EnumSet.of(Status.PENDING_DESCRIPTOR, Status.PENDING_CONTENTS, Status.COPYING, Status.QUARANTINED,
|
||||
Status.QUARANTINE_EXPIRED))) {
|
||||
assert VCloudExpressComputeServiceContextModule.vAppStatusToNodeState.containsKey(state) : state;
|
||||
assert VCloudExpressComputeServiceContextModule.VAPPSTATUS_TO_NODESTATE.containsKey(state) : state;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -36,7 +36,7 @@ public class VCloudExpressComputeServiceContextModuleTest {
|
|||
for (Status state : EnumSet.allOf(Status.class).complementOf(
|
||||
EnumSet.of(Status.PENDING_DESCRIPTOR, Status.PENDING_CONTENTS, Status.COPYING, Status.QUARANTINED,
|
||||
Status.QUARANTINE_EXPIRED))) {
|
||||
assert VCloudExpressComputeServiceContextModule.vAppStatusToNodeState.containsKey(state) : state;
|
||||
assert VCloudExpressComputeServiceContextModule.VAPPSTATUS_TO_NODESTATE.containsKey(state) : state;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -42,18 +42,18 @@ import com.google.inject.Provides;
|
|||
public abstract class CommonVCloudComputeServiceContextModule extends BaseComputeServiceContextModule {
|
||||
|
||||
@VisibleForTesting
|
||||
static final Map<Status, NodeState> vAppStatusToNodeState = ImmutableMap.<Status, NodeState> builder().put(
|
||||
Status.OFF, NodeState.SUSPENDED).put(Status.ON, NodeState.RUNNING).put(Status.RESOLVED, NodeState.PENDING)
|
||||
.put(Status.ERROR, NodeState.ERROR).put(Status.UNRECOGNIZED, NodeState.UNRECOGNIZED).put(Status.DEPLOYED,
|
||||
NodeState.PENDING).put(Status.INCONSISTENT, NodeState.PENDING).put(Status.UNKNOWN,
|
||||
NodeState.UNRECOGNIZED).put(Status.MIXED, NodeState.PENDING).put(Status.WAITING_FOR_INPUT,
|
||||
NodeState.PENDING).put(Status.SUSPENDED, NodeState.SUSPENDED).put(Status.UNRESOLVED,
|
||||
NodeState.PENDING).build();
|
||||
public static final Map<Status, NodeState> VAPPSTATUS_TO_NODESTATE = ImmutableMap.<Status, NodeState> builder()
|
||||
.put(Status.OFF, NodeState.SUSPENDED).put(Status.ON, NodeState.RUNNING)
|
||||
.put(Status.RESOLVED, NodeState.PENDING).put(Status.ERROR, NodeState.ERROR)
|
||||
.put(Status.UNRECOGNIZED, NodeState.UNRECOGNIZED).put(Status.DEPLOYED, NodeState.PENDING)
|
||||
.put(Status.INCONSISTENT, NodeState.PENDING).put(Status.UNKNOWN, NodeState.UNRECOGNIZED)
|
||||
.put(Status.MIXED, NodeState.PENDING).put(Status.WAITING_FOR_INPUT, NodeState.PENDING)
|
||||
.put(Status.SUSPENDED, NodeState.SUSPENDED).put(Status.UNRESOLVED, NodeState.PENDING).build();
|
||||
|
||||
@Singleton
|
||||
@Provides
|
||||
Map<Status, NodeState> provideVAppStatusToNodeState() {
|
||||
return vAppStatusToNodeState;
|
||||
protected Map<Status, NodeState> provideVAppStatusToNodeState() {
|
||||
return VAPPSTATUS_TO_NODESTATE;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -63,8 +63,7 @@ public class FindLocationForResource {
|
|||
// link that only includes href and type.
|
||||
if (URI.create(input.getId()).equals(resource.getHref()))
|
||||
return input;
|
||||
input = input.getParent();
|
||||
} while (input.getParent() != null);
|
||||
} while ((input = input.getParent()) != null);
|
||||
}
|
||||
throw new NoSuchElementException(String.format("resource: %s not found in locations: %s", resource, locations
|
||||
.get()));
|
||||
|
|
|
@ -21,6 +21,9 @@ package org.jclouds.util;
|
|||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import com.google.common.base.Predicate;
|
||||
import com.google.common.base.Splitter;
|
||||
import com.google.common.collect.Iterables;
|
||||
import com.google.common.net.InetAddresses;
|
||||
|
@ -31,26 +34,40 @@ import com.google.common.net.InetAddresses;
|
|||
* @author Adrian Cole
|
||||
*/
|
||||
public class InetAddresses2 {
|
||||
@Singleton
|
||||
public static enum IsPrivateIPAddress implements Predicate<String> {
|
||||
INSTANCE;
|
||||
|
||||
public boolean apply(String in) {
|
||||
if (InetAddresses.isInetAddress(checkNotNull(in, "input address"))) {
|
||||
// 24-bit Block (/8 prefix, 1/A) 10.0.0.0 10.255.255.255 16777216
|
||||
if (in.indexOf("10.") == 0)
|
||||
return true;
|
||||
// 20-bit Block (/12 prefix, 16/B) 172.16.0.0 172.31.255.255 1048576
|
||||
if (in.indexOf("172.") == 0) {
|
||||
int second = Integer.parseInt(Iterables.get(Splitter.on('.').split(in), 1));
|
||||
if (second >= 16 && second <= 31)
|
||||
return true;
|
||||
}
|
||||
// 16-bit Block (/16 prefix, 256/C) 192.168.0.0 192.168.255.255 65536
|
||||
if (in.indexOf("192.168.") == 0)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "isPrivateIPAddress()";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @return true if the input is an ip4 address and in one of the 3 reserved private blocks.
|
||||
*/
|
||||
public static boolean isPrivateIPAddress(String in) {
|
||||
if (InetAddresses.isInetAddress(checkNotNull(in, "input address"))) {
|
||||
// 24-bit Block (/8 prefix, 1 × A) 10.0.0.0 10.255.255.255 16777216
|
||||
if (in.indexOf("10.") == 0)
|
||||
return true;
|
||||
// 20-bit Block (/12 prefix, 16 × B) 172.16.0.0 172.31.255.255 1048576
|
||||
if (in.indexOf("172.") == 0) {
|
||||
int second = Integer.parseInt(Iterables.get(Splitter.on('.').split(in), 1));
|
||||
if (second >= 16 && second <= 31)
|
||||
return true;
|
||||
}
|
||||
// 16-bit Block (/16 prefix, 256 × C) 192.168.0.0 192.168.255.255 65536
|
||||
if (in.indexOf("192.168.") == 0)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
return IsPrivateIPAddress.INSTANCE.apply(in);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue