Revision 31a853d2 scripts/gnt-instance
b/scripts/gnt-instance | ||
---|---|---|
40 | 40 |
_SHUTDOWN_INSTANCES = "instances" |
41 | 41 |
|
42 | 42 |
|
43 |
_VALUE_TRUE = "true" |
|
44 |
|
|
43 | 45 |
_LIST_DEF_FIELDS = [ |
44 | 46 |
"name", "os", "pnode", "status", "oper_ram", |
45 | 47 |
] |
... | ... | |
254 | 256 |
kernel_path = _TransformPath(opts.kernel_path) |
255 | 257 |
initrd_path = _TransformPath(opts.initrd_path) |
256 | 258 |
|
259 |
hvm_acpi = opts.hvm_acpi == _VALUE_TRUE |
|
260 |
hvm_pae = opts.hvm_pae == _VALUE_TRUE |
|
261 |
|
|
262 |
if ((opts.hvm_cdrom_image_path is not None) and |
|
263 |
(opts.hvm_cdrom_image_path.lower() == constants.VALUE_NONE)): |
|
264 |
hvm_cdrom_image_path = None |
|
265 |
else: |
|
266 |
hvm_cdrom_image_path = opts.hvm_cdrom_image_path |
|
267 |
|
|
257 | 268 |
op = opcodes.OpCreateInstance(instance_name=instance, mem_size=opts.mem, |
258 | 269 |
disk_size=opts.size, swap_size=opts.swap, |
259 | 270 |
disk_template=opts.disk_template, |
... | ... | |
266 | 277 |
mac=opts.mac, |
267 | 278 |
kernel_path=kernel_path, |
268 | 279 |
initrd_path=initrd_path, |
280 |
iallocator=opts.iallocator, |
|
269 | 281 |
hvm_boot_order=opts.hvm_boot_order, |
270 | 282 |
file_storage_dir=opts.file_storage_dir, |
271 | 283 |
file_driver=opts.file_driver, |
272 |
iallocator=opts.iallocator) |
|
284 |
hvm_acpi=hvm_acpi, hvm_pae=hvm_pae, |
|
285 |
hvm_cdrom_image_path=hvm_cdrom_image_path, |
|
286 |
vnc_bind_address=opts.vnc_bind_address) |
|
287 |
|
|
273 | 288 |
SubmitOpCode(op) |
274 | 289 |
return 0 |
275 | 290 |
|
... | ... | |
641 | 656 |
else: |
642 | 657 |
initrd = instance["initrd_path"] |
643 | 658 |
buf.write(" initrd: %s\n" % initrd) |
644 |
buf.write(" HVM boot order: %s\n" % instance["hvm_boot_order"]) |
|
659 |
buf.write(" HVM:\n") |
|
660 |
buf.write(" - boot order: %s\n" % instance["hvm_boot_order"]) |
|
661 |
buf.write(" - ACPI support: %s\n" % instance["hvm_acpi"]) |
|
662 |
buf.write(" - PAE support: %s\n" % instance["hvm_pae"]) |
|
663 |
buf.write(" - virtual CDROM: %s\n" % instance["hvm_cdrom_image_path"]) |
|
664 |
buf.write(" VNC bind address: %s\n" % instance["vnc_bind_address"]) |
|
645 | 665 |
buf.write(" Hardware:\n") |
646 | 666 |
buf.write(" - VCPUs: %d\n" % instance["vcpus"]) |
647 | 667 |
buf.write(" - memory: %dMiB\n" % instance["memory"]) |
... | ... | |
673 | 693 |
|
674 | 694 |
""" |
675 | 695 |
if not (opts.mem or opts.vcpus or opts.ip or opts.bridge or opts.mac or |
676 |
opts.kernel_path or opts.initrd_path or opts.hvm_boot_order): |
|
696 |
opts.kernel_path or opts.initrd_path or opts.hvm_boot_order or |
|
697 |
opts.hvm_acpi or opts.hvm_acpi or opts.hvm_cdrom_image_path or |
|
698 |
opts.vnc_bind_address): |
|
677 | 699 |
logger.ToStdout("Please give at least one of the parameters.") |
678 | 700 |
return 1 |
679 | 701 |
|
... | ... | |
684 | 706 |
else: |
685 | 707 |
hvm_boot_order = opts.hvm_boot_order |
686 | 708 |
|
709 |
hvm_acpi = opts.hvm_acpi == _VALUE_TRUE |
|
710 |
hvm_pae = opts.hvm_pae == _VALUE_TRUE |
|
711 |
|
|
712 |
if ((opts.hvm_cdrom_image_path is not None) and |
|
713 |
(opts.hvm_cdrom_image_path.lower() == constants.VALUE_NONE)): |
|
714 |
hvm_cdrom_image_path = None |
|
715 |
else: |
|
716 |
hvm_cdrom_image_path = opts.hvm_cdrom_image_path |
|
717 |
|
|
687 | 718 |
op = opcodes.OpSetInstanceParams(instance_name=args[0], mem=opts.mem, |
688 | 719 |
vcpus=opts.vcpus, ip=opts.ip, |
689 | 720 |
bridge=opts.bridge, mac=opts.mac, |
690 | 721 |
kernel_path=opts.kernel_path, |
691 | 722 |
initrd_path=opts.initrd_path, |
692 |
hvm_boot_order=hvm_boot_order) |
|
723 |
hvm_boot_order=hvm_boot_order, |
|
724 |
hvm_acpi=hvm_acpi, hvm_pae=hvm_pae, |
|
725 |
hvm_cdrom_image_path=hvm_cdrom_image_path, |
|
726 |
vnc_bind_address=opts.vnc_bind_address) |
|
727 |
|
|
693 | 728 |
result = SubmitOpCode(op) |
694 | 729 |
|
695 | 730 |
if result: |
... | ... | |
792 | 827 |
make_option("--iallocator", metavar="<NAME>", |
793 | 828 |
help="Select nodes for the instance automatically using the" |
794 | 829 |
" <NAME> iallocator plugin", default=None, type="string"), |
830 |
make_option("--hvm-acpi", dest="hvm_acpi", |
|
831 |
help="ACPI support for HVM (true|false)", |
|
832 |
metavar="<BOOL>", choices=["true", "false"]), |
|
833 |
make_option("--hvm-pae", dest="hvm_pae", |
|
834 |
help="PAE support for HVM (true|false)", |
|
835 |
metavar="<BOOL>", choices=["true", "false"]), |
|
836 |
make_option("--hvm-cdrom-image-path", dest="hvm_cdrom_image_path", |
|
837 |
help="CDROM image path for HVM (absolute path or None)", |
|
838 |
default=None, type="string", metavar="<CDROMIMAGE>"), |
|
839 |
make_option("--vnc-bind-address", dest="vnc_bind_address", |
|
840 |
help="bind address for VNC (IP address)", |
|
841 |
default=None, type="string", metavar="<VNCADDRESS>"), |
|
795 | 842 |
] |
796 | 843 |
|
797 | 844 |
commands = { |
... | ... | |
899 | 946 |
help="boot device order for HVM" |
900 | 947 |
"(either one or more of [acdn] or 'default')", |
901 | 948 |
default=None, type="string", metavar="<BOOTORDER>"), |
949 |
make_option("--hvm-acpi", dest="hvm_acpi", |
|
950 |
help="ACPI support for HVM (true|false)", |
|
951 |
metavar="<BOOL>", choices=["true", "false"]), |
|
952 |
make_option("--hvm-pae", dest="hvm_pae", |
|
953 |
help="PAE support for HVM (true|false)", |
|
954 |
metavar="<BOOL>", choices=["true", "false"]), |
|
955 |
make_option("--hvm-cdrom-image-path", |
|
956 |
dest="hvm_cdrom_image_path", |
|
957 |
help="CDROM image path for HVM" |
|
958 |
"(absolute path or None)", |
|
959 |
default=None, type="string", metavar="<CDROMIMAGE>"), |
|
960 |
make_option("--vnc-bind-address", dest="vnc_bind_address", |
|
961 |
help="bind address for VNC (IP address)", |
|
962 |
default=None, type="string", metavar="<VNCADDRESS>"), |
|
902 | 963 |
], |
903 | 964 |
"<instance>", "Alters the parameters of an instance"), |
904 | 965 |
'shutdown': (ShutdownInstance, ARGS_ANY, |
Also available in: Unified diff