#109 Allow to specify number of CPU cores to be assigned
Merged 2 years ago by frantisekz. Opened 2 years ago by frantisekz.

file modified
+5 -5
@@ -188,6 +188,11 @@ 

  : To set the amount of RAM that will be available to the virtual

      machine (in MiB).

  

+ \--vcpus VCPUS

+ 

+ : To set the amount of VCPUS that will be available to the virtual

+     machine.

+ 

  \--no-graphic

  

  : This turns off the graphical display of the virtual machine.
@@ -212,11 +217,6 @@ 

  There are several additional options that can be used to create a

  new Coreos instance using **testcloud**.

  

- \--vcpus VCPUS

- 

- : To set the amount of VCPUS that will be available to the virtual

-     machine.

- 

  \--fcc_file FCC_FILE

  

  : To provide a fcc_file you want to use

file modified
+1 -1
@@ -3,7 +3,7 @@ 

    <uuid>{{ uuid }}</uuid>

    <memory unit='KiB'>{{ memory }}</memory>

    <currentMemory unit='KiB'>{{ memory }}</currentMemory>

-   <vcpu placement='static'>1</vcpu>

+   <vcpu placement='static'>{{ vcpus }}</vcpu>

    <os>

      <type arch='x86_64' machine='pc'>hvm</type>

      {{ uefi_loader }}

file modified
+3
@@ -95,6 +95,9 @@ 

  \fB--ram RAM\fR

          Set the amount of RAM that will be available to the instance's VM (in MiB).

  

+ \fB--vcpus VCPUS\fR

+         Set the number of virtual CPU cores to be assinged to the VM.

+ 

  \fB--disksize DISKSIZE\fR

          Set the disk size of the instance VM (in GiB).

  

file modified
+6 -4
@@ -417,6 +417,9 @@ 

          if not args.disksize:

              tc_instance.disk_size = config_data.DISK_SIZE

  

+         # set vcpus

+         tc_instance.vcpus = args.vcpus

+ 

      # prepare instance

      try:

          tc_instance.prepare()
@@ -776,6 +779,9 @@ 

                                  help="Specify the amount of ram in MiB for the VM.",

                                  type=int,

                                  default=config_data.RAM)

+     instarg_create.add_argument("--vcpus",

+                                 help="Number of virtual CPU cores to assign to the VM.",

+                                 default=config_data.VCPUS)

      instarg_create.add_argument("--no-graphic",

                                  help="Turn off graphical display.",

                                  action="store_true")
@@ -785,7 +791,6 @@ 

      instarg_create.add_argument("--atomic",

                                  help="Use this flag if you're booting an Atomic Host.",

                                  action="store_true")

-     # this might work better as a second, required positional arg

      instarg_create.add_argument("--timeout",

                                  help="Time (in seconds) to wait for boot to "

                                       "complete before completion, setting to 0"
@@ -808,9 +813,6 @@ 

      instarg_create.add_argument("--ign_file",

                                  help="specify your ign file path",

                                  type=str)

-     instarg_create.add_argument("--vcpus",

-                                 help="vcpu number",

-                                 default=config_data.VCPUS)

  

      imgarg = subparsers.add_parser("image", help="help on image options")

      imgarg_subp = imgarg.add_subparsers(title="subcommands",

file modified
+2 -1
@@ -213,6 +213,7 @@ 

          self.local_disk = "{}/{}-local.qcow2".format(self.path, self.name)

          self.xml_path = "{}/{}-domain.xml".format(self.path, self.name)

          self.ram = config_data.RAM

+         self.vcpus = config_data.VCPUS

          # desired size of disk, in GiB

          self.disk_size = config_data.DISK_SIZE

          self.vnc = False
@@ -557,6 +558,7 @@ 

          instance_values = {'domain_name': self.name,

                             'uuid': uuid.uuid4(),

                             'memory': self.ram * 1024,  # MiB to KiB

+                            'vcpus': self.vcpus,

                             'disk': self.local_disk,

                             'mac_address': util.generate_mac_address(),

                             'uefi_loader': "",
@@ -569,7 +571,6 @@ 

              instance_values['seed'] = self.seed_path

          else:

              xml_template = jinjaEnv.get_template(config_data.XML_TEMPLATE_COREOS)

-             instance_values['vcpus'] = self.vcpus

              if config_data.CMD_LINE_ARGS_COREOS or config_data.CMD_LINE_ENVS_COREOS:

                  cmdline_args = config_data.CMD_LINE_ARGS_COREOS + ['name=opt/com.coreos/config,file=%s'%self.config_path, ]

                  for qemu_arg in cmdline_args: