Currently, the only way to set the description of a VM (shows in the
lower right of the overview display in the graphical UI)
programmatically is to edit the XML file and add a description element
there. The attached patch adds the functionality to just call

VBoxManage modifyvm MY_VM_NAME --description 'My First VM'

I hereby license the attached patch under MIT License.

Best regards,

Philipp
Index: src/VBox/Frontends/VBoxManage/VBoxManageHelp.cpp
===================================================================
--- src/VBox/Frontends/VBoxManage/VBoxManageHelp.cpp	(revision 45470)
+++ src/VBox/Frontends/VBoxManage/VBoxManageHelp.cpp	(working copy)
@@ -163,6 +163,7 @@
         RTStrmPrintf(pStrm,
                            "%s modifyvm %s        <uuid|name>\n"
                      "                            [--name <name>]\n"
+                     "                            [--description <description>]\n"
                      "                            [--groups <group>, ...]\n"
                      "                            [--ostype <ostype>]\n"
                      "                            [--memory <memorysize in MB>]\n"
Index: src/VBox/Frontends/VBoxManage/VBoxManageModifyVM.cpp
===================================================================
--- src/VBox/Frontends/VBoxManage/VBoxManageModifyVM.cpp	(revision 45470)
+++ src/VBox/Frontends/VBoxManage/VBoxManageModifyVM.cpp	(working copy)
@@ -49,6 +49,7 @@
 enum
 {
     MODIFYVM_NAME = 1000,
+    MODIFYVM_DESCRIPTION,
     MODIFYVM_GROUPS,
     MODIFYVM_OSTYPE,
     MODIFYVM_MEMORY,
@@ -203,6 +204,7 @@
 static const RTGETOPTDEF g_aModifyVMOptions[] =
 {
     { "--name",                     MODIFYVM_NAME,                      RTGETOPT_REQ_STRING },
+    { "--description",              MODIFYVM_DESCRIPTION,               RTGETOPT_REQ_STRING },
     { "--groups",                   MODIFYVM_GROUPS,                    RTGETOPT_REQ_STRING },
     { "--ostype",                   MODIFYVM_OSTYPE,                    RTGETOPT_REQ_STRING },
     { "--memory",                   MODIFYVM_MEMORY,                    RTGETOPT_REQ_UINT32 },
@@ -443,6 +445,11 @@
                 CHECK_ERROR(machine, COMSETTER(Name)(Bstr(ValueUnion.psz).raw()));
                 break;
             }
+            case MODIFYVM_DESCRIPTION:
+            {
+                CHECK_ERROR(machine, COMSETTER(Description)(Bstr(ValueUnion.psz).raw()));
+                break;
+            }
             case MODIFYVM_GROUPS:
             {
                 com::SafeArray<BSTR> groups;

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
vbox-dev mailing list
[email protected]
https://www.virtualbox.org/mailman/listinfo/vbox-dev

Reply via email to