Package com.cybozu.vmbkp.soap

Examples of com.cybozu.vmbkp.soap.VirtualMachineManager


    public static void createSnapshot()
        throws Exception
    {
        String snapName = "snapshot-test";
       
        VirtualMachineManager vmm = gm_.searchVmWithName(vmName_);
        assert vmm != null;
        vmm.createSnapshot(snapName);

        SnapshotManager spm = vmm.searchSnapshotWithName(snapName);
        System.out.printf("-----disk list of %s of %s-----\n",
                          spm.getName(), spm.getVirtualMachine().getName());
        Utility.printList(spm.getConfig().getAllDiskNameList());

        System.out.printf("-----vmdkinfo list-----\n");
View Full Code Here


     */
    public static void deleteSnapshot()
        throws Exception
    {
        String snapName = "snapshot-test";
        VirtualMachineManager vmm = gm_.searchVmWithName(vmName_);
        assert vmm != null;
        vmm.deleteSnapshot(snapName);
    }
View Full Code Here

     * Ovf export of a virtual machine.
     */
    public static void exportOvf(String vmName)
        throws Exception
    {
        VirtualMachineManager vmm = gm_.searchVmWithName(vmName);
        if (vmm != null) {
            String ret = vmm.exportOvf();
            FileWriter fw = new FileWriter("ovf/" + vmm.getName() + ".ovf2");
            fw.write(ret);
            fw.close();
               
            VmbkpOvf ovf = new VmbkpOvf(ret);
            ovf.replaceFileLinkInReferences();
            String ret2 = ovf.toString();
            FileWriter fw2 = new FileWriter("ovf/" + vmm.getName() + ".ovf3");
            fw2.write(ret2);
            fw2.close();
        }
    }
View Full Code Here

    public static void deleteAllRestoredVm(int num)
        throws Exception
    {
        for (int i = 0; i < num; ++ i) {
            String vmName = "ovftest-" + String.valueOf(i);
            VirtualMachineManager vmm = gm_.searchVmWithName(vmName);
            if (vmm != null) {
                System.out.printf("destroy %s...", vmName);
                boolean ret = gm_.destroyVm(vmm);
                if (ret) {
                    System.out.printf("success\n");
View Full Code Here

        BackupInfo backupInfo = new BackupInfo(cmdLine_);
       
        for (String vmMoref: targetVmMorefList_) {
           
            /* Target virtual machine */
            VirtualMachineManager vmm = gm_.searchVmWithMoref(vmMoref);
            VmInfo vmInfo = vmm.getVmInfo();
            VmArchiveManager vmArcMgr =
                new VmArchiveManager(cfgGlobal_, vmInfo);

            boolean ret = false;
            try {
View Full Code Here

            throw new Exception(msg);
        }

        for (String targetVmMoref: targetVmMorefList_) {

            VirtualMachineManager vmm = gm_.searchVmWithMoref(targetVmMoref);
            VmInfo info = vmm.getVmInfo();
            if (gm_.destroyVm(vmm)) {
                System.out.printf
                    ("Destroy %s(%s) succeeded.\n",
                     info.getName(), info.getMoref());
            } else {
View Full Code Here

        assert (morefOfNewVm != null);
        msg = "import succeeded.";
        System.out.println(msg); logger_.info(msg);

        /* 6. Add contorollers and empty disks. */
        VirtualMachineManager vmm = gm_.searchVmWithMoref(morefOfNewVm);
        if (vmm == null) {
            throw new Exception("Could not find newly created vm.");
        }
        vmm.addEmptyDisks(vcmList);
        vmm.reload(); /* reload to get information of added disks
                         for the next step. */
        {
            int numDisks = 0;
            for (VirtualControllerManager vcm : vcmList) {
                numDisks += vcm.getNumOfDisks();
            }
            msg = String.format("add empty %d disks succeeded.", numDisks);
        }
        System.out.println(msg); logger_.info(msg);

        /* 7. Get VmdkInfo list for remote disk path of
              the newly created vmdk files,
              and get the corresponding diskId to restore.
              Then call vmdkbkp command to restore each vmdk file. */
        if (restoreInfo.isNoVmdk) {
            msg = String.format
                ("Disks are not restored because specified --novmdk option.");
            System.out.println(msg); logger_.info(msg);
           
        } else {
            /* Create snapshot and get moref of the snapshot. */
            Calendar cal = Calendar.getInstance();
            String snapName = generateSnapshotName(cal);
            createSnapshot(vmm, snapName);
            msg = String.format
                ("create snapshot name %s succeeded.", snapName);
            System.out.println(msg); logger_.info(msg);
               
            SnapshotManager snap = vmm.getCurrentSnapshot();
            if (snap == null || snapName.equals(snap.getName()) == false) {
                throw new Exception("Could not get snapshot.");
            }
            String snapMoref = snap.getMoref();
           
View Full Code Here

TOP

Related Classes of com.cybozu.vmbkp.soap.VirtualMachineManager

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.