VBOX: Guest additions may not be available on all hosts. If not found, skip it.

This commit is contained in:
Rom Walton 2014-10-20 10:07:16 -04:00
parent 3136342575
commit 609a2924b3
1 changed files with 39 additions and 32 deletions

View File

@ -226,8 +226,7 @@ int VBOX_VM::initialize() {
rc = get_version_information(virtualbox_version);
if (rc) return rc;
rc = get_guest_additions(virtualbox_guest_additions);
if (rc) return rc;
get_guest_additions(virtualbox_guest_additions);
return 0;
}
@ -770,22 +769,26 @@ int VBOX_VM::create_vm() {
retval = vbm_popen(command, output, "storage attach (ISO 9660 image)");
if (retval) return retval;
// Add guest additions to the VM
//
fprintf(
stderr,
"%s Adding VirtualBox Guest Additions to VM.\n",
vboxwrapper_msg_prefix(buf, sizeof(buf))
);
command = "storageattach \"" + vm_name + "\" ";
command += "--storagectl \"Hard Disk Controller\" ";
command += "--port 2 ";
command += "--device 0 ";
command += "--type dvddrive ";
command += "--medium \"" + virtualbox_guest_additions + "\" ";
if (!virtualbox_guest_additions.empty()) {
retval = vbm_popen(command, output, "storage attach (guest additions image)");
if (retval) return retval;
// Add guest additions to the VM
//
fprintf(
stderr,
"%s Adding VirtualBox Guest Additions to VM.\n",
vboxwrapper_msg_prefix(buf, sizeof(buf))
);
command = "storageattach \"" + vm_name + "\" ";
command += "--storagectl \"Hard Disk Controller\" ";
command += "--port 2 ";
command += "--device 0 ";
command += "--type dvddrive ";
command += "--medium \"" + virtualbox_guest_additions + "\" ";
retval = vbm_popen(command, output, "storage attach (guest additions image)");
if (retval) return retval;
}
// Add a virtual cache disk drive to VM
//
@ -829,22 +832,26 @@ int VBOX_VM::create_vm() {
retval = vbm_popen(command, output, "storage attach (fixed disk)");
if (retval) return retval;
// Add guest additions to the VM
//
fprintf(
stderr,
"%s Adding VirtualBox Guest Additions to VM.\n",
vboxwrapper_msg_prefix(buf, sizeof(buf))
);
command = "storageattach \"" + vm_name + "\" ";
command += "--storagectl \"Hard Disk Controller\" ";
command += "--port 1 ";
command += "--device 0 ";
command += "--type dvddrive ";
command += "--medium \"" + virtualbox_guest_additions + "\" ";
if (!virtualbox_guest_additions.empty()) {
retval = vbm_popen(command, output, "storage attach (guest additions image)");
if (retval) return retval;
// Add guest additions to the VM
//
fprintf(
stderr,
"%s Adding VirtualBox Guest Additions to VM.\n",
vboxwrapper_msg_prefix(buf, sizeof(buf))
);
command = "storageattach \"" + vm_name + "\" ";
command += "--storagectl \"Hard Disk Controller\" ";
command += "--port 1 ";
command += "--device 0 ";
command += "--type dvddrive ";
command += "--medium \"" + virtualbox_guest_additions + "\" ";
retval = vbm_popen(command, output, "storage attach (guest additions image)");
if (retval) return retval;
}
}