com.vmware.vim25.mo.samples.vm.VMClone.class Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of vijava Show documentation
Show all versions of vijava Show documentation
Java API for accessing VMWare web services API
The newest version!
???? 2 ? &com/vmware/vim25/mo/samples/vm/VMClone java/lang/Object ()V Code
LineNumberTable LocalVariableTable this (Lcom/vmware/vim25/mo/samples/vm/VMClone; main ([Ljava/lang/String;)V
Exceptions java/lang/Exception *com/vmware/vim25/mo/util/CommandLineParser
constructOptions (()[Lcom/vmware/vim25/mo/util/OptionSpec;
<([Lcom/vmware/vim25/mo/util/OptionSpec;[Ljava/lang/String;)V url
!
get_option &(Ljava/lang/String;)Ljava/lang/String; # username % password ' CloneName ) vmPath + DatacenterName - #com/vmware/vim25/mo/ServiceInstance / java/net/URL
. 1 2 (Ljava/lang/String;)V
, 4 5 6(Ljava/net/URL;Ljava/lang/String;Ljava/lang/String;Z)V
, 7 8 9 getSearchIndex #()Lcom/vmware/vim25/mo/SearchIndex;
; = < com/vmware/vim25/mo/SearchIndex > ? findByInventoryPath 7(Ljava/lang/String;)Lcom/vmware/vim25/mo/ManagedEntity; A "com/vmware/vim25/mo/VirtualMachine C com/vmware/vim25/mo/Datacenter E G F java/lang/System H I out Ljava/io/PrintStream; K DVirtualMachine or Datacenter path is NOT correct. Pls double check.
M O N java/io/PrintStream P 2 println
B R S T getVmFolder ()Lcom/vmware/vim25/mo/Folder; V (com/vmware/vim25/VirtualMachineCloneSpec
U Y +com/vmware/vim25/VirtualMachineRelocateSpec
X
U \ ] ^ setLocation 0(Lcom/vmware/vim25/VirtualMachineRelocateSpec;)V
U ` a b
setPowerOn (Z)V
U d e b setTemplate
@ g h i cloneVM_Task t(Lcom/vmware/vim25/mo/Folder;Ljava/lang/String;Lcom/vmware/vim25/VirtualMachineCloneSpec;)Lcom/vmware/vim25/mo/Task; k RLaunching the VM clone task. It might take a while. Please wait for the result ...
m o n com/vmware/vim25/mo/Task p q waitForMe ()Ljava/lang/String; s success u (Virtual Machine got cloned successfully. w +Failure -: Virtual Machine cannot be cloned
y { z java/rmi/RemoteException | printStackTrace
~ { java/net/MalformedURLException args [Ljava/lang/String; clp ,Lcom/vmware/vim25/mo/util/CommandLineParser; urlStr Ljava/lang/String; cloneName datacenterName si %Lcom/vmware/vim25/mo/ServiceInstance; vm $Lcom/vmware/vim25/mo/VirtualMachine; dc Lcom/vmware/vim25/mo/Datacenter; vmFolder Lcom/vmware/vim25/mo/Folder; cloneSpec *Lcom/vmware/vim25/VirtualMachineCloneSpec; task Lcom/vmware/vim25/mo/Task; status re Ljava/rmi/RemoteException; mue Ljava/net/MalformedURLException;
StackMapTable ? ? java/lang/String ? com/vmware/vim25/mo/Folder ? #com/vmware/vim25/mo/util/OptionSpec ? String ? Name of the Datacenter
? ? ? L(Ljava/lang/String;Ljava/lang/String;ILjava/lang/String;Ljava/lang/String;)V ? Path to the VM inventory ? Name of the Clone useroptions &[Lcom/vmware/vim25/mo/util/OptionSpec;
SourceFile VMClone.java ! / *? ?
K
? ? Y? *? L+? M+"? N+$? :+&? :+(? :+*? :? ,Y? .Y,? 0-? 3:? 6? :? @: ? 6? :? B:
?
? ? DJ? L?
? Q:? UY? W:? XY? Z? [? _? c ? f:
? Dj? L
? l:r? ? Dt? L? ? Dv? L? :? x?
:? }? : ? y ? ? ? y : ? ~ ? ? ? ~
v O Q R S " T * U 2 V : Z O [ ^ \ m ^ w ` a ? c ? e ? f ? g ? h ? j ? k ? m ? n ? p ? t ? w ? y ? { ? } ? ? ? ? ? ? ? ? ? ? ? ? # ? " ? % ? * ? ? ? 2 ? ) ? : ? ? ? O ? ? ? ^ ? ? ? m t ? ?
? Z ? ? ? Q ? ? ? , ? ?
? ? ? ? ? ? ? ? ? ? ? ? w ? ? ? ? ? ? ? , @ B ? U ? ? ? ? ? ? ? , @ B ? U m ? ? ? ? ? ? ? ? ? yI ~
? =? ?K*? ?Y*??? ?S*? ?Y(??? ?S*? ?Y&??? ?S*?
. ? ? ? ? ? " ? ( ? ) ? 4 ? : ? ; ? 8 ? ? ? ?