Hello Lloyd,

I believe you need to do vmadm update [UUID] -f /path/to/add_nic.json

mine is below, modify depending on your needs.

#cat add_nic.json
{
    "add_nics": [
        {
            "physical": "net5",
            "mac": "62:80:88:a7:fc:6b",
            "nic_tag": "wifi",
            "index": 6,
            "ip": "dhcp",
            "model": "e1000",
            "allow_dhcp_spoofing": true,
            "allow_ip_spoofing": true,
            "allow_mac_spoofing": true,
            "allow_restricted_traffic": true,
            "allow_unfiltered_promisc": true
        }
    ]
}

https://wiki.smartos.org/display/DOC/Using+vmadm+to+manage+virtual+machines#Usingvmadmtomanagevirtualmachines-AddaNICtoaVMthenremoveit

On Mon, Apr 18, 2016 at 5:41 AM, Lloyd Parkes <[email protected]
> wrote:

> Hi Dave,
> Yeah, I stopped and started the guest rather than rebooting. I've been
> bitten by that before.
>
> Cheers
>
> On 18 April 2016 at 21:11, Dave Finster <[email protected]> wrote:
>
>> Hi Lloyd
>>
>> Just double checking - when you say you’ve rebooted the guest, do you
>> mean a full cycle (where the VM is shown as stopped in vmadm) or just
>> rebooting using the guests internal tools?
>>
>> To introduce new NICs the QEMU process needs to be stopped and started,
>> which only happens when the VM is completely stopped either via an OS
>> shutdown and subsequent vmadm start <uuid> or via vmadm stop <uuid> and
>> vmadm start <uuid>
>>
>> - Dave
>>
>> On 18 Apr 2016, at 7:05 PM, Lloyd Parkes <
>> [email protected]> wrote:
>>
>> Hi all,
>> I tried adding a second NIC to a KVM guest, but it never shows up in the
>> guest. I noticed that the necessary parameters weren't in the
>> /zones/UUID/root/startvm script so I added them and rebooted the zone, at
>> which point I found that the startvm script is rewritten every time the
>> zone is booted. Obviously whatever makes that script doesn't understand
>> multiple NICs.
>>
>> Is this a known bug? Is it fixed? I'm running a custom build
>> of joyent_20151204T225629Z and I'm sure I could build a newer one if I had
>> to. (I did "lose" the guest I was using to do the builds by accident).
>>
>> Cheers,
>> Lloyd
>>
>> Gory details of JSON and shell script follow.
>> [root@maro ~]# vmadm get 9281337f-d364-4026-b40a-f8d72bf7c535 | json nics
>> [
>>   {
>>     "interface": "net0",
>>     "mac": "22:b0:99:3f:87:6d",
>>     "vlan_id": 18,
>>     "nic_tag": "desktop",
>>     "gateway": "10.0.1.1",
>>     "gateways": [
>>       "10.0.1.1"
>>     ],
>>     "netmask": "255.255.255.0",
>>     "ip": "10.0.1.51",
>>     "ips": [
>>       "10.0.1.51/24"
>>     ],
>>     "model": "virtio",
>>     "primary": true
>>   },
>>   {
>>     "interface": "net1",
>>     "mac": "22:b0:99:3f:87:6e",
>>     "vlan_id": 2048,
>>     "nic_tag": "desktop",
>>     "gateway": "10.128.0.1",
>>     "gateways": [
>>       "10.128.0.1"
>>     ],
>>     "ips": [
>>       "addrconf"
>>     ],
>>     "allowed_ips": [
>>       "10.128.0.0/24",
>>       "2001:470:f05b:8000::/64"
>>     ],
>>     "model": "virtio",
>>     "dhcp_server": true,
>>     "allow_dhcp_spoofing": true
>>   }
>> ]
>> [root@maro ~]# cat
>> /zones/9281337f-d364-4026-b40a-f8d72bf7c535/root/startvm
>> #!/usr/bin/bash
>>
>> exec >/tmp/vm.startvm.log 2>&1
>>
>> set -o xtrace
>>
>> if [[ -x /startvm.zone ]]; then
>>     exec /smartdc/bin/qemu-exec /startvm.zone "-m" "2048" "-name"
>> "9281337f-d364-4026-b40a-f8d72bf7c535" "-uuid"
>> "9281337f-d364-4026-b40a-f8d72bf7c535" "-cpu" "qemu64" "-smp" "2" "-drive"
>> "file=/dev/zvol/rdsk/zones/9281337f-d364-4026-b40a-f8d72bf7c535-disk0,if=virtio,index=0,media=disk,boot=on"
>> "-boot" "order=cd" "-device"
>> "virtio-net-pci,mac=22:b0:99:3f:87:6d,tx=timer,x-txtimer=200000,x-txburst=128,vlan=0"
>> "-net"
>> "vnic,name=net0,vlan=0,ifname=net0,ip=10.0.1.51,netmask=255.255.255.0,gateway_ip=10.0.1.1,hostname=maas,dns_ip0=10.0.1.36,dns_ip1=10.0.1.9"
>> "-smbios" "type=1,manufacturer=Joyent,product=SmartDC
>> HVM,version=7.20151204T225629Z,serial=9281337f-d364-4026-b40a-f8d72bf7c535,uuid=9281337f-d364-4026-b40a-f8d72bf7c535,sku=001,family=Virtual
>> Machine" "-pidfile" "/tmp/vm.pid" "-vga" "std" "-chardev"
>> "socket,id=qmp,path=/tmp/vm.qmp,server,nowait" "-qmp" "chardev:qmp"
>> "-chardev" "socket,id=serial0,path=/tmp/vm.console,server,nowait" "-serial"
>> "chardev:serial0" "-chardev"
>> "socket,id=serial1,path=/tmp/vm.ttyb,server,nowait" "-serial"
>> "chardev:serial1" "-vnc" "unix:/tmp/vm.vnc,password" "-parallel" "none"
>> "-usb" "-usbdevice" "tablet" "-k" "en-us"
>> else
>>     exec /smartdc/bin/qemu-exec /smartdc/bin/qemu-system-x86_64 "-m"
>> "2048" "-name" "9281337f-d364-4026-b40a-f8d72bf7c535" "-uuid"
>> "9281337f-d364-4026-b40a-f8d72bf7c535" "-cpu" "qemu64" "-smp" "2" "-drive"
>> "file=/dev/zvol/rdsk/zones/9281337f-d364-4026-b40a-f8d72bf7c535-disk0,if=virtio,index=0,media=disk,boot=on"
>> "-boot" "order=cd" "-device"
>> "virtio-net-pci,mac=22:b0:99:3f:87:6d,tx=timer,x-txtimer=200000,x-txburst=128,vlan=0"
>> "-net"
>> "vnic,name=net0,vlan=0,ifname=net0,ip=10.0.1.51,netmask=255.255.255.0,gateway_ip=10.0.1.1,hostname=maas,dns_ip0=10.0.1.36,dns_ip1=10.0.1.9"
>> "-smbios" "type=1,manufacturer=Joyent,product=SmartDC
>> HVM,version=7.20151204T225629Z,serial=9281337f-d364-4026-b40a-f8d72bf7c535,uuid=9281337f-d364-4026-b40a-f8d72bf7c535,sku=001,family=Virtual
>> Machine" "-pidfile" "/tmp/vm.pid" "-vga" "std" "-chardev"
>> "socket,id=qmp,path=/tmp/vm.qmp,server,nowait" "-qmp" "chardev:qmp"
>> "-chardev" "socket,id=serial0,path=/tmp/vm.console,server,nowait" "-serial"
>> "chardev:serial0" "-chardev"
>> "socket,id=serial1,path=/tmp/vm.ttyb,server,nowait" "-serial"
>> "chardev:serial1" "-vnc" "unix:/tmp/vm.vnc,password" "-parallel" "none"
>> "-usb" "-usbdevice" "tablet" "-k" "en-us"
>> fi
>>
>> exit 1
>> [root@maro ~]# uname -a
>> SunOS maro 5.11 joyent_20151204T225629Z i86pc i386 i86pc
>>
>>
>> *smartos-discuss* | Archives
>> <https://www.listbox.com/member/archive/184463/=now>
>> <https://www.listbox.com/member/archive/rss/184463/25862483-3ffcc027> |
>> Modify <https://www.listbox.com/member/?&;> Your Subscription
>> <http://www.listbox.com/>
>>
>
> *smartos-discuss* | Archives
> <https://www.listbox.com/member/archive/184463/=now>
> <https://www.listbox.com/member/archive/rss/184463/24697919-04ed9bf0> |
> Modify
> <https://www.listbox.com/member/?&;>
> Your Subscription <http://www.listbox.com>
>



-------------------------------------------
smartos-discuss
Archives: https://www.listbox.com/member/archive/184463/=now
RSS Feed: https://www.listbox.com/member/archive/rss/184463/25769125-55cfbc00
Modify Your Subscription: 
https://www.listbox.com/member/?member_id=25769125&id_secret=25769125-7688e9fb
Powered by Listbox: http://www.listbox.com

Reply via email to