Hacking XenServer: Open vSwitch Controller (DVSC) Changing Password

If you have had trouble getting access to the Distributed vSwitch Controller (DVSC) in XenServer, then you are not alone!

While doing some testing on XenServer’s vSwitch and following XenServers documentation we noticed it was not possible to using the “Switch to Graphical Mode” that was referenced in the documentation.  While the “Switch to Graphical Mode” was there in XenCenter, it was grayed out. Rebooting, or re-importing the DVSC appliance did not help.

All the passwords listed in the XenServer documentation, and on their forums did not work – so as an extreme resort you can do the following to reset the password so you can set your IP address and get in via the web interface:

  1. Import the DVSC appliance, do not select the option to start on boot.
  2. Detach the disk from the VM, and attach to a VM that is already running a working installation of Linux (in this case I attached it to a CentOS 5 VM). It is easier to identify the virtual disk if you change the name of the disk before you detach it, especially if you have a large number of virtual disks.  If you have lost it, try looking for a virtual disk of 16GB in size with no home.
  3. Once you have attached the disk, run “fdisk -l” to make sure the virtual disk is there.
  4. Run something along the lines of the following (may vary depending on what disk ID the disk has been assigned), this will mount the filesystem of the XenServer Distributed Virtual Switch to /mnt:
    mount /mnt /dev/xvdb1
  5. Next you want to chroot into that filesystem so we can change the password for the user “admin”:
    chroot /mnt
  6. Now for the actual password change:
    password admin
  7. Once you have entered the password, and it has successfully been changed, do the following:
    ctrl + d (logout of chroot)
    umount /mnt
  8. Detach the drive from your test VM, and re-attach it to your DVSC VM.

After booting your DVSC VM you should now be able to access the vSwitch’s CLI using the username admin, and the password you set above.

If the original reason you wanted to get into the VM was to set a static password, then you can use the command:

set controller management-interface config static [ip address] [netmask] [gateway]

Now you should be able to access the Distributed vSwitch by using https://[ipaddress/ – the default username is “admin” and the default password is “admin”.