cheng029 发表于 2015-7-14 15:49:42

使用指定的静态IP地址启动云主机(PaaS云主机GitServer要求使用固定IP)

使用指定的静态IP地址启动云主机

1.命令格式:
nova boot --flavor <flavor-id> --image <image-id> --nic net-id=<net-id>,v4-fixed-ip=<ip address> <vm-name>

2.命令帮助:
# nova help boot
usage: nova boot [--flavor <flavor>] [--image <image>]
               [--image-with <key=value>] [--boot-volume <volume_id>]
               [--snapshot <snapshot_id>] [--num-instances <number>]
               [--meta <key=value>] [--file <dst-path=src-path>]
               [--key-name <key-name>] [--user-data <user-data>]
               [--availability-zone <availability-zone>]
               [--security-groups <security-groups>]
               [--block-device-mapping <dev-name=mapping>]
               [--block-device key1=value1[,key2=value2...]]
               [--swap <swap_size>]
               [--ephemeral size=<size>[,format=<format>]]
               [--hint <key=value>]
               [--nic <net-id=net-uuid,v4-fixed-ip=ip-addr,port-id=port-uuid>]
               [--config-drive <value>] [--poll]
               <name>

Boot a new server.

Positional arguments:
<name>                Name for the new server

Optional arguments:
--flavor <flavor>   Name or ID of flavor (see 'nova flavor-list').
--image <image>       Name or ID of image (see 'nova image-list').
--nic <net-id=net-uuid,v4-fixed-ip=ip-addr,port-id=port-uuid>
                        Create a NIC on the server. Specify option multiple
                        times to create multiple NICs. net-id: attach NIC to
                        network with this UUID (required if no port-id), v4
                        -fixed-ip: IPv4 fixed address for NIC (optional),
                        port-id: attach NIC to port with this UUID (required
                        if no net-id)

3.操作过程:
# nova flavor-list
+--------------------------------------+-----------+-----------+------+-----------+------+-------+-------------+-----------+
| ID                                 | Name      | Memory_MB | Disk | Ephemeral | Swap | VCPUs | RXTX_Factor | Is_Public |
+--------------------------------------+-----------+-----------+------+-----------+------+-------+-------------+-----------+
| 1                                    | m1.tiny   | 512       | 1    | 0         |      | 1   | 1.0         | True      |
| 2                                    | m1.small| 2048      | 20   | 0         |      | 1   | 1.0         | True      |
| 3                                    | m1.medium | 4096      | 40   | 0         |      | 2   | 1.0         | True      |
| 4                                    | m1.large| 8192      | 80   | 0         |      | 4   | 1.0         | True      |
| 5                                    | m1.xlarge | 16384   | 160| 0         |      | 8   | 1.0         | True      |
| 750dbfc1-3b75-4d33-a3fe-4f9d7821ce23 | PaaS      | 2048      | 10   | 0         |      | 1   | 1.0         | True      |
+--------------------------------------+-----------+-----------+------+-----------+------+-------+-------------+-----------+

# nova image-list
+--------------------------------------+-------------------+--------+--------+
| ID                                 | Name            | Status | Server |
+--------------------------------------+-------------------+--------+--------+
| 48cb1672-3c92-4b72-9ac5-c3f5b68a5bfc | CentOS-6.5-x86_64 | ACTIVE |      |
+--------------------------------------+-------------------+--------+--------+

# neutron net-list
+--------------------------------------+----------+-------------------------------------------------------+
| id                                 | name   | subnets                                             |
+--------------------------------------+----------+-------------------------------------------------------+
| 201837d5-3f43-4828-9480-918dae7fc672 | flat-net | 269222fa-ba55-4712-bb32-6b7a1280bfe8 192.168.200.0/24 |
+--------------------------------------+----------+-------------------------------------------------------+

# nova boot --flavor PaaS --image 48cb1672-3c92-4b72-9ac5-c3f5b68a5bfc --nic net-id=201837d5-3f43-4828-9480-918dae7fc672,v4-fixed-ip=192.168.200.200 paas

# nova list
+--------------------------------------+------+--------+------------+-------------+--------------------------+
| ID                                 | Name | Status | Task State | Power State | Networks               |
+--------------------------------------+------+--------+------------+-------------+--------------------------+
| bde14835-12cd-4d96-a855-63d8df2ffa54 | paas | ACTIVE | -          | Running   | flat-net=192.168.200.200 |
+--------------------------------------+------+--------+------------+-------------+--------------------------+
页: [1]
查看完整版本: 使用指定的静态IP地址启动云主机(PaaS云主机GitServer要求使用固定IP)