def create_hard_disk_medium(outputfile, format = nil)
      # Get main VirtualBox object
      virtualbox = Lib.lib.virtualbox

      # Assign the default format if it isn't set yet
      format ||= virtualbox.system_properties.default_hard_disk_format

      # Expand path relative to the default hard disk folder. This allows
      # filenames to exist in the default folder while full paths will use
      # the paths specified.
      outputfile = File.expand_path(outputfile, virtualbox.system_properties.default_hard_disk_folder)

      # If the outputfile path is in use by another Hard Drive, lets fail
      # now with a meaningful exception rather than simply return a nil
      raise Exceptions::MediumLocationInUseException.new(outputfile) if File.exist?(outputfile)

      # Create the new {COM::Interface::Medium} instance.
      new_medium = virtualbox.create_hard_disk(format, outputfile)

      # Raise an error if the creation of the {COM::Interface::Medium}
      # instance failed
      raise Exceptions::MediumCreationFailedException.new unless new_medium

      # Return the new {COM::Interface::Medium} instance.
      new_medium
    end
def create_hard_disk_medium(outputfile, format = nil)
      # Get main VirtualBox object
      virtualbox = Lib.lib.virtualbox

      # Assign the default format if it isn't set yet
      format ||= virtualbox.system_properties.default_hard_disk_format

      # Expand path relative to the default hard disk folder. This allows
      # filenames to exist in the default folder while full paths will use
      # the paths specified.
      outputfile = File.expand_path(outputfile, virtualbox.system_properties.default_hard_disk_folder)

      # If the outputfile path is in use by another Hard Drive, lets fail
      # now with a meaningful exception rather than simply return a nil
      raise Exceptions::MediumLocationInUseException.new(outputfile) if File.exist?(outputfile)

      # Create the new {COM::Interface::Medium} instance.
      new_medium = virtualbox.create_hard_disk(format, outputfile)

      # Raise an error if the creation of the {COM::Interface::Medium}
      # instance failed
      raise Exceptions::MediumCreationFailedException.new unless new_medium

      # Return the new {COM::Interface::Medium} instance.
      new_medium
    end
Creates a new {COM::Interface::Medium} instance. This simply creates
 the new {COM::Interface::Medium} structure. It does not (and shouldn't)
 create the storage space on the host system. See the create method for
 an example on to create the storage space.

 @param [String] outputfile The output file. This can be a full path
   or just a filename. If its just a filename, it will be placed in
   the default hard drives directory. Should not be present already.
 @param [String] format The format to convert to. If not present, the
   systems default will be used.
 @return [COM::Interface::Medium] The new {COM::Interface::Medium} instance
   or will raise a {Exceptions::MediumCreationFailedException} on failure.