VirtualBox

Ignore:
Timestamp:
May 22, 2008 5:35:37 AM (17 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
31139
Message:

Partially implemented rename vmdk api call.

Location:
trunk/src/VBox/Frontends/VBoxManage
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VBoxManage/VBoxInternalManage.cpp

    r8982 r9047  
    166166                "\n"
    167167                : "",
     168#if 0
     169             (u64Cmd & USAGE_RENAMEVMDK) ?
     170                 "  renamevmdk -from <filename> -to <filename>\n"
     171                 "       Renames an existing VMDK image, including the base file and all its extents.\n"
     172                 "\n"
     173                 : "",
     174#endif
    168175#ifdef RT_OS_WINDOWS
    169176            (u64Cmd & USAGE_MODINSTALL) ?
     
    11311138}
    11321139
     1140#if 0
     1141HRESULT CmdRenameVMDK(int argc, char **argv, ComPtr<IVirtualBox> aVirtualBox, ComPtr<ISession> aSession)
     1142{
     1143    Bstr src;
     1144    Bstr dst;
     1145    /* Parse the arguments. */
     1146    for (int i = 0; i < argc; i++)
     1147    {
     1148        if (strcmp(argv[i], "-from") == 0)
     1149        {
     1150            if (argc <= i + 1)
     1151            {
     1152                return errorArgument("Missing argument to '%s'", argv[i]);
     1153            }
     1154            i++;
     1155            src = argv[i];
     1156        }
     1157        else if (strcmp(argv[i], "-to") == 0)
     1158        {
     1159            if (argc <= i + 1)
     1160            {
     1161                return errorArgument("Missing argument to '%s'", argv[i]);
     1162            }
     1163            i++;
     1164            dst = argv[i];
     1165        }
     1166        else
     1167        {
     1168            return errorSyntax(USAGE_RENAMEVMDK, "Invalid parameter '%s'", Utf8Str(argv[i]).raw());
     1169        }
     1170    }
     1171
     1172    if (src.isEmpty())
     1173        return errorSyntax(USAGE_RENAMEVMDK, "Mandatory parameter -from missing");
     1174    if (dst.isEmpty())
     1175        return errorSyntax(USAGE_RENAMEVMDK, "Mandatory parameter -to missing");
     1176
     1177    PVBOXHDD pDisk = NULL;
     1178
     1179    int vrc = VDCreate(handleVDError, NULL, &pDisk);
     1180    if (VBOX_FAILURE(vrc))
     1181    {
     1182        RTPrintf("Error while creating the virtual disk container: %Vrc\n", vrc);
     1183        return vrc;
     1184    }
     1185    else
     1186    {
     1187        vrc = VDOpen(pDisk, "VMDK", Utf8Str(src).raw(), VD_OPEN_FLAGS_NORMAL);
     1188        if (VBOX_FAILURE(vrc))
     1189        {
     1190            RTPrintf("Error while opening the source image: %Vrc\n", vrc);
     1191        }
     1192        else
     1193        {
     1194            vrc = VDCopy(pDisk, 0, pDisk, "VMDK", Utf8Str(dst).raw(), true, 0, NULL, NULL);
     1195            if (VBOX_FAILURE(vrc))
     1196            {
     1197                RTPrintf("Error while renaming the image: %Vrc\n", vrc);
     1198            }
     1199        }
     1200    }
     1201    VDCloseAll(pDisk);
     1202    return vrc;
     1203}
     1204#endif
     1205
    11331206/**
    11341207 * Unloads the neccessary driver.
     
    11911264    if (!strcmp(pszCmd, "createrawvmdk"))
    11921265        return CmdCreateRawVMDK(argc - 1, &argv[1], aVirtualBox, aSession);
     1266#if 0
     1267    if (!strcmp(pszCmd, "renamevmdk"))
     1268        return CmdRenameVMDK(argc - 1, &argv[1], aVirtualBox, aSession);
     1269#endif
    11931270
    11941271    if (!strcmp(pszCmd, "modinstall"))
  • trunk/src/VBox/Frontends/VBoxManage/VBoxManage.h

    r8155 r9047  
    7474#define USAGE_MODINSTALL            RT_BIT_64(37)
    7575#define USAGE_MODUNINSTALL          RT_BIT_64(38)
     76#ifndef VBOX_OSE
     77# define USAGE_RENAMEVMDK           RT_BIT_64(39)
     78#endif /* !VBOX_OSE */
    7679#define USAGE_ALL                   (~(uint64_t)0)
    7780/** @} */
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette