Revision 74409b12 scripts/gnt-instance

b/scripts/gnt-instance
771 771

  
772 772
  """
773 773
  if not (opts.mem or opts.vcpus or opts.ip or opts.bridge or opts.mac or
774
          opts.kernel_path or opts.initrd_path or opts.hvm_boot_order or
775
          opts.hvm_acpi or opts.hvm_pae or opts.hvm_cdrom_image_path or
776
          opts.vnc_bind_address or opts.hvm_nic_type or opts.hvm_disk_type):
774
          opts.hypervisor):
777 775
    logger.ToStdout("Please give at least one of the parameters.")
778 776
    return 1
779 777

  
780
  kernel_path = _TransformPath(opts.kernel_path)
781
  initrd_path = _TransformPath(opts.initrd_path)
782
  if opts.hvm_boot_order == 'default':
783
    hvm_boot_order = constants.VALUE_DEFAULT
784
  else:
785
    hvm_boot_order = opts.hvm_boot_order
786

  
787
  if opts.hvm_acpi is None:
788
    hvm_acpi = opts.hvm_acpi
789
  else:
790
    hvm_acpi = opts.hvm_acpi == _VALUE_TRUE
791

  
792
  if opts.hvm_pae is None:
793
    hvm_pae = opts.hvm_pae
794
  else:
795
    hvm_pae = opts.hvm_pae == _VALUE_TRUE
796

  
797
  if opts.hvm_nic_type == constants.VALUE_NONE:
798
    hvm_nic_type = None
799
  else:
800
    hvm_nic_type = opts.hvm_nic_type
801

  
802
  if opts.hvm_disk_type == constants.VALUE_NONE:
803
    hvm_disk_type = None
804
  else:
805
    hvm_disk_type = opts.hvm_disk_type
806

  
807 778
  op = opcodes.OpSetInstanceParams(instance_name=args[0], mem=opts.mem,
808 779
                                   vcpus=opts.vcpus, ip=opts.ip,
809 780
                                   bridge=opts.bridge, mac=opts.mac,
810
                                   kernel_path=opts.kernel_path,
811
                                   initrd_path=opts.initrd_path,
812
                                   hvm_boot_order=hvm_boot_order,
813
                                   hvm_acpi=hvm_acpi, hvm_pae=hvm_pae,
814
                                   hvm_cdrom_image_path=
815
                                   opts.hvm_cdrom_image_path,
816
                                   vnc_bind_address=opts.vnc_bind_address,
817
                                   hvm_nic_type=hvm_nic_type,
818
                                   hvm_disk_type=hvm_disk_type,
781
                                   hvparams=opts.hypervisor,
819 782
                                   force=opts.force)
820 783

  
821 784
  # even if here we process the result, we allow submit only
......
1037 1000
              make_option("--mac", dest="mac",
1038 1001
                          help="MAC address", default=None,
1039 1002
                          type="string", metavar="<MACADDRESS>"),
1040
              make_option("--kernel", dest="kernel_path",
1041
                          help="Path to the instances' kernel (or"
1042
                          " 'default')", default=None,
1043
                          type="string", metavar="<FILENAME>"),
1044
              make_option("--initrd", dest="initrd_path",
1045
                          help="Path to the instances' initrd (or 'none', or"
1046
                          " 'default')", default=None,
1047
                          type="string", metavar="<FILENAME>"),
1048
              make_option("--hvm-boot-order", dest="hvm_boot_order",
1049
                          help="boot device order for HVM"
1050
                          "(either one or more of [acdn] or 'default')",
1051
                          default=None, type="string", metavar="<BOOTORDER>"),
1052
              make_option("--hvm-acpi", dest="hvm_acpi",
1053
                          help="ACPI support for HVM (true|false)",
1054
                          metavar="<BOOL>", choices=["true", "false"]),
1055
              make_option("--hvm-pae", dest="hvm_pae",
1056
                          help="PAE support for HVM (true|false)",
1057
                          metavar="<BOOL>", choices=["true", "false"]),
1058
              make_option("--hvm-cdrom-image-path",
1059
                          dest="hvm_cdrom_image_path",
1060
                          help="CDROM image path for HVM"
1061
                          "(absolute path or None)",
1062
                          default=None, type="string", metavar="<CDROMIMAGE>"),
1063
              make_option("--hvm-nic-type", dest="hvm_nic_type",
1064
                          help="Type of virtual NIC for HVM "
1065
                          "(rtl8139,ne2k_pci,ne2k_isa,paravirtual)",
1066
                          metavar="NICTYPE",
1067
                          choices=[constants.HT_HVM_NIC_RTL8139,
1068
                                   constants.HT_HVM_NIC_NE2K_PCI,
1069
                                   constants.HT_HVM_NIC_NE2K_ISA,
1070
                                   constants.HT_HVM_DEV_PARAVIRTUAL],
1071
                          default=None),
1072
              make_option("--hvm-disk-type", dest="hvm_disk_type",
1073
                          help="Type of virtual disks for HVM "
1074
                          "(ioemu,paravirtual)",
1075
                          metavar="DISKTYPE",
1076
                          choices=[constants.HT_HVM_DEV_IOEMU,
1077
                                   constants.HT_HVM_DEV_PARAVIRTUAL],
1078
                          default=None),
1079
              make_option("--vnc-bind-address", dest="vnc_bind_address",
1080
                          help="bind address for VNC (IP address)",
1081
                          default=None, type="string", metavar="<VNCADDRESS>"),
1003
              keyval_option("-H", "--hypervisor", type="keyval",
1004
                            default={}, dest="hypervisor",
1005
                            help="Change hypervisor parameters"),
1082 1006
              SUBMIT_OPT,
1083 1007
              ],
1084 1008
             "<instance>", "Alters the parameters of an instance"),

Also available in: Unified diff