Sha256: 4781c4e8d324f0889244a838b59a88ecf2e88534227cdf5333bbb22b2a321925

Contents?: true

Size: 1.87 KB

Versions: 29

Compression:

Stored size: 1.87 KB

Contents

module Veewee
  module Provider
    module Parallels
      module BoxCommand

        # When we create a new box
        # We assume the box is not running
        def create(options)
          create_vm
          create_disk
          #self.create_floppy("virtualfloppy.img")
        end


        def create_disk
        end

        def parallels_os_type(type_id)
          env.logger.info "Translating #{type_id} into parallels type"
          parallelstype=env.ostypes[type_id][:parallels]
          env.logger.info "Found Parallels type #{parallelstype}"
          return parallelstype
        end

        def create_vm
          parallels_definition=definition.dup
          distribution=parallels_os_type(definition.os_type_id)

          # Create the vm
          command="prlctl create '#{self.name}' --distribution '#{distribution}'"
          shell_exec("#{command}")
          command="prlctl set '#{self.name}' --cpus #{definition.cpu_count} --memsize #{definition.memory_size}"
          shell_exec("#{command}")


          #NOTE: order is important: as this determines the boot order sequence
          #
          # Remove the network to disable pxe boot
          command="prlctl set '#{self.name}' --device-del net0"
          shell_exec("#{command}")

          # Remove default cdrom
          command ="prlctl set '#{self.name}' --device-del cdrom0"
          shell_exec("#{command}")
          #
          # Attach cdrom
          full_iso_file=File.join(env.config.veewee.iso_dir,definition.iso_file)
          ui.info "Mounting cdrom: #{full_iso_file}"
          command ="prlctl set '#{self.name}' --device-add cdrom --enable --image '#{full_iso_file}'"
          shell_exec("#{command}")

          #Enable the network again
          command="prlctl set '#{self.name}' --device-add net --enable --type shared"
          shell_exec("#{command}")



        end

      end
    end
  end
end

Version data entries

29 entries across 29 versions & 2 rubygems

Version Path
veewee-0.5.0.alpha4 lib/veewee/provider/parallels/box/create.rb
veewee-0.5.0.alpha3 lib/veewee/provider/parallels/box/create.rb
veewee-0.5.0.alpha2 lib/veewee/provider/parallels/box/create.rb
veewee-0.5.0.alpha1 lib/veewee/provider/parallels/box/create.rb
veewee-0.4.5.1 lib/veewee/provider/parallels/box/create.rb
veewee-0.4.5 lib/veewee/provider/parallels/box/create.rb
veewee-0.4.5.pre1 lib/veewee/provider/parallels/box/create.rb
veewee-0.4.4 lib/veewee/provider/parallels/box/create.rb
veewee-0.4.3 lib/veewee/provider/parallels/box/create.rb
veewee-0.4.2 lib/veewee/provider/parallels/box/create.rb
veewee-0.4.1 lib/veewee/provider/parallels/box/create.rb
veewee-0.4.0 lib/veewee/provider/parallels/box/create.rb
veewee-0.3.12 lib/veewee/provider/parallels/box/create.rb
veewee-0.3.11 lib/veewee/provider/parallels/box/create.rb
veewee-0.3.10 lib/veewee/provider/parallels/box/create.rb
veewee-0.3.9 lib/veewee/provider/parallels/box/create.rb
veewee-atlassian-0.3.11 lib/veewee/provider/parallels/box/create.rb
veewee-0.3.7 lib/veewee/provider/parallels/box/create.rb
veewee-0.3.6 lib/veewee/provider/parallels/box/create.rb
veewee-0.3.5 lib/veewee/provider/parallels/box/create.rb