Examples of VmInfo


Examples of com.cybozu.vmbkp.util.VmInfo

     * Get VmInfo.
     */
    public VmInfo getVmInfo()
    {
        if (vm_ == null) { return null; }
        return new VmInfo(getName(), getMoref());
    }
View Full Code Here

Examples of com.cybozu.vmbkp.util.VmInfo

       
        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 {
                int timeoutSec = 60;
                if (backupInfo.isDryRun) {timeoutSec = 0;}
               
                vmArcMgr.lock(timeoutSec);
                vmArcMgr.reload();
                ret = backupVm(vmm, vmArcMgr, backupInfo);
               
            } catch (Exception e) {
                logException
                    (e, String.format
                     ("backupVm of %s failed.", vmMoref));
            } finally {
                vmArcMgr.unlock();
            }

            System.out.printf("BACKUP %s %s\n",
                              (ret ? "OK" : "NG"), vmInfo.toString());
        }
    }
View Full Code Here

Examples of com.cybozu.vmbkp.util.VmInfo

        String targetVmMoref = targetVmMorefList_.get(0);

        RestoreInfo restoreInfo =
            new RestoreInfo(cmdLine_);

        VmInfo vmInfo = profAllVm_.makeVmInfoWithMoref(targetVmMoref);
        assert vmInfo != null;

        VmArchiveManager vmArcMgr =
            new VmArchiveManager(cfgGlobal_, vmInfo);
       
View Full Code Here

Examples of com.cybozu.vmbkp.util.VmInfo

            throw new Exception(msg);
        }

        for (String targetVmMoref: targetVmMorefList_) {

            VmInfo vmInfo = profAllVm_.makeVmInfoWithMoref(targetVmMoref);
            assert vmInfo != null;

            VmArchiveManager vmArcMgr =
                new VmArchiveManager(cfgGlobal_, vmInfo);

            boolean isClean = false;
            try {
                int timeoutSec = 60;
                if (checkInfo.isDryRun) {timeoutSec = 0;}
           
                vmArcMgr.lock(timeoutSec);
                vmArcMgr.reload();
                isClean = checkGeneration(vmArcMgr, checkInfo);
           
            } catch (Exception e) {
                logException
                    (e, String.format
                     ("checkGeneration of %s failed.", targetVmMoref));
            } finally {
                vmArcMgr.unlock();
            }

            System.out.printf("CHECK %s %s: %d\n",
                              (isClean ? "OK" : "NG"),
                              vmInfo.toString(),
                              checkInfo.generationId);
        }
    }
View Full Code Here

Examples of com.cybozu.vmbkp.util.VmInfo

        }

        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 {
                throw new Exception("destroy virtual machine failed.");
            }
        }
    }
View Full Code Here

Examples of com.cybozu.vmbkp.util.VmInfo

            throw new Exception(msg);
        }

        for (String targetVmMoref: targetVmMorefList_) {

            VmInfo vmInfo = profAllVm_.makeVmInfoWithMoref(targetVmMoref);
            assert vmInfo != null;

            boolean isExist =
                VmArchiveManager.isExistSucceededGeneration(cfgGlobal_, vmInfo);
            boolean isEmptyArchive =
                VmArchiveManager.isEmptyArchive(cfgGlobal_, vmInfo);
           
            if (! isExist && ! isEmptyArchive) {
                String msg = String.format
                    ("Archive of %s does not exist.", vmInfo.toString());
                logger_.warning(msg);
                System.err.println(msg);
                continue;
            }

            boolean isSucceeded = false;
            if (cleanInfo.isAll || isEmptyArchive) {

                try {
                    deleteVmArchive(vmInfo, cleanInfo);
                    isSucceeded = true;
                } catch (Exception e) {
                    String msg = String.format
                        ("Clean all of %s failed.", targetVmMoref);
                    logException(e, msg);
                    System.err.println(msg);
                }
            } else {

                VmArchiveManager vmArcMgr =
                    new VmArchiveManager(cfgGlobal_, vmInfo);
                try {
                    int timeoutSec = 1;
                    if (cleanInfo.isDryRun) { timeoutSec = 0; }

                    vmArcMgr.lock(timeoutSec);
                    vmArcMgr.reload();
                    deleteFailedGenerations(vmArcMgr, cleanInfo);
                    isSucceeded = true;

                } catch(Exception e) {
                    String msg = String.format
                        ("Clean %s failed.", targetVmMoref);
                    logException(e, msg);
                    System.err.println(msg);
                } finally {
                    vmArcMgr.unlock();
                }
            }
            System.out.printf("CLEAN %s %s.\n",
                              vmInfo.toString(),
                              (isSucceeded ? "succeeded" : "failed"));
        }
    }
View Full Code Here

Examples of com.cybozu.vmbkp.util.VmInfo

        /* 3. mtime/mmin filter. */
        if (listInfo.isMtime || listInfo.isMmin) {
            tlist = new LinkedList<String>();
           
            for (String moref: morefs) {
                VmInfo vmInfo = profAllVm_.makeVmInfoWithMoref(moref);
                if (VmArchiveManager.isExistSucceededGeneration(cfgGlobal_, vmInfo)) {
                    VmArchiveManager vmArcMgr =
                        new VmArchiveManager(cfgGlobal_, vmInfo);

                    long tsGen = vmArcMgr.getTimestampMsOfLatestGeneration();
View Full Code Here

Examples of com.cybozu.vmbkp.util.VmInfo

        StatusInfo statusInfo = new StatusInfo(cmdLine_);
       
        for (String vmMoref: targetVmMorefList_) {

            VmInfo vmInfo = profAllVm_.makeVmInfoWithMoref(vmMoref);
            if (vmInfo  == null) {
                logger_.warning(vmMoref + " not found.");
                continue;
            }

            /* Check archive existance. */
            if (! VmArchiveManager.isExistSucceededGeneration(cfgGlobal_, vmInfo)) {
                System.out.printf("[%s][%s] ##########_NO_ARCHIVE_##########\n",
                                  vmInfo.getMoref(), vmInfo.getName());
                continue;
            }

            /* Try to load archive metadata. */
            VmArchiveManager vmArcMgr;
            try {
                vmArcMgr = new VmArchiveManager(cfgGlobal_, vmInfo);
            } catch (Exception e) {
                logException(e);
                System.out.printf("[%s][%s] ##########_ERROR_##########\n",
                                  vmInfo.getMoref(), vmInfo.getName());
                continue;
            }

            /* Get status information from the metadata. */
            try {
                vmArcMgr.lock(0);
                vmArcMgr.reload();

                boolean isAvailable = profAllVm_.isAvailableWithMoref(vmMoref);
                System.out.println
                    (vmArcMgr.getStatusString(statusInfo, isAvailable));
               
            } catch (LockTimeoutException e) {
                logException(e, "lock timeout" + vmInfo.toString());
                System.out.printf("[%s][%s] ##########_LOCKED_##########\n",
                                  vmInfo.getMoref(), vmInfo.getName());
            } catch (Exception e) {
                logException
                    (e, String.format
                     ("Reload profile of %s failed.", vmInfo.toString()));
            } finally {
                vmArcMgr.unlock();
            }
        }
    }
View Full Code Here

Examples of com.cybozu.vmbkp.util.VmInfo

    public VmInfo makeVmInfoWithMoref(String vmMoref)
    {
        if (vmMoref == null) { return null; }
        String vmName = this.getVmNameWithMoref(vmMoref);
        if (vmName == null) { return null; }
        return new VmInfo(vmName, vmMoref);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.