update TODO; removed Datacenter class

This commit is contained in:
andreaturli 2010-12-29 10:54:01 +01:00
parent 048bfd7f73
commit 132dbd9827
4 changed files with 19 additions and 71 deletions

View File

@ -1 +1 @@
runNodesWithTag: when ask for more than 1 node, cloning step fails cause of concurrent access to the originale virtual disk to be cloned. runNodesWithTag: pass VirtualMachineRelocateSpec using Template?

View File

@ -1,56 +0,0 @@
/**
*
* 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.vi;
import com.google.common.base.Objects;
/**
* This would be replaced with the real java object related to the underlying data center
*
* @author Adrian Cole
*/
public class Datacenter {
public int id;
public String name;
public Datacenter(int id, String name) {
this.id = id;
this.name = name;
}
@Override
public int hashCode() {
return Objects.hashCode(id, name);
}
@Override
public boolean equals(Object that) {
if (that == null)
return false;
return Objects.equal(this.toString(), that.toString());
}
@Override
public String toString() {
return Objects.toStringHelper(this).add("id", id).add("name", name).toString();
}
}

View File

@ -68,7 +68,7 @@ import com.vmware.vim25.mo.Task;
import com.vmware.vim25.mo.VirtualMachine; import com.vmware.vim25.mo.VirtualMachine;
/** /**
* defines the connection between the {@link Libvirt} implementation and the jclouds * defines the connection between the {@link VI} implementation and the jclouds
* {@link ComputeService} * {@link ComputeService}
* *
*/ */

View File

@ -25,10 +25,10 @@ import java.util.Set;
import org.jclouds.compute.ComputeServiceContext; import org.jclouds.compute.ComputeServiceContext;
import org.jclouds.compute.ComputeServiceContextFactory; import org.jclouds.compute.ComputeServiceContextFactory;
import org.jclouds.compute.domain.ComputeMetadata;
import org.jclouds.compute.domain.Hardware; import org.jclouds.compute.domain.Hardware;
import org.jclouds.compute.domain.Image; import org.jclouds.compute.domain.Image;
import org.jclouds.compute.domain.NodeMetadata; import org.jclouds.domain.Location;
import org.jclouds.compute.domain.Template;
import org.testng.annotations.BeforeClass; import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test; import org.testng.annotations.Test;
@ -59,19 +59,22 @@ public class ViExperimentLiveTest {
context = new ComputeServiceContextFactory().createContext(new ViComputeServiceContextSpec( context = new ComputeServiceContextFactory().createContext(new ViComputeServiceContextSpec(
endpoint, identity, credential)); endpoint, identity, credential));
// Set<? extends Location> locations = context.getComputeService().listAssignableLocations(); Set<? extends Location> locations = context.getComputeService().listAssignableLocations();
// for (Location location : locations) {
System.out.println("location id: " + location.getId() + " - desc: " + location.getDescription());
}
// Set<? extends ComputeMetadata> nodes = context.getComputeService().listNodes(); // Set<? extends ComputeMetadata> nodes = context.getComputeService().listNodes();
// //
// Set<? extends Hardware> hardwares = context.getComputeService().listHardwareProfiles(); Set<? extends Hardware> hardwares = context.getComputeService().listHardwareProfiles();
// for (Hardware hardware : hardwares) { for (Hardware hardware : hardwares) {
// System.out.println("hardware id: " + hardware.getId()); System.out.println("hardware id: " + hardware.getId() + " - name: " + hardware.getName());
// } }
// //
// Set<? extends Image> images = context.getComputeService().listImages(); Set<? extends Image> images = context.getComputeService().listImages();
// for (Image image : images) { for (Image image : images) {
// System.out.println("id: " + image.getId() + " - name:" + image.getName()); System.out.println("id: " + image.getId() + " - name:" + image.getName());
// } }
// //
// NodeMetadata node = context.getComputeService().getNodeMetadata("MyWinServer"); // NodeMetadata node = context.getComputeService().getNodeMetadata("MyWinServer");
// System.out.println(node); // System.out.println(node);
@ -84,7 +87,7 @@ public class ViExperimentLiveTest {
Template defaultTemplate = context.getComputeService().templateBuilder() Template defaultTemplate = context.getComputeService().templateBuilder()
.hardwareId("vm-1221").imageId("winNetEnterprise64Guest") //.locationId("") .hardwareId("vm-1221").imageId("winNetEnterprise64Guest") //.locationId("")
.build(); .build();
*/
Set<? extends NodeMetadata> nodeMetadataSet = context.getComputeService().runNodesWithTag("MyWinServer", 1); Set<? extends NodeMetadata> nodeMetadataSet = context.getComputeService().runNodesWithTag("MyWinServer", 1);
for (NodeMetadata nodeMetadata : nodeMetadataSet) { for (NodeMetadata nodeMetadata : nodeMetadataSet) {
@ -93,6 +96,7 @@ public class ViExperimentLiveTest {
//context.getComputeService().destroyNode(nodeMetadata.getId()); //context.getComputeService().destroyNode(nodeMetadata.getId());
} }
*/
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();