Merge "Convert legacy-tempest-dsvm-neutron-pg-full to Zuul v3"
diff --git a/.zuul.yaml b/.zuul.yaml
index 18b74ae..594a440 100644
--- a/.zuul.yaml
+++ b/.zuul.yaml
@@ -436,7 +436,7 @@
             irrelevant-files: *tempest-irrelevant-files
         - neutron-grenade-multinode:
             irrelevant-files: *tempest-irrelevant-files
-        - legacy-tempest-dsvm-neutron-full:
+        - tempest-full:
             irrelevant-files: *tempest-irrelevant-files
         - neutron-grenade:
             irrelevant-files: *tempest-irrelevant-files
diff --git a/releasenotes/notes/bug-1791007-328a8b9a43bfb157.yaml b/releasenotes/notes/bug-1791007-328a8b9a43bfb157.yaml
new file mode 100644
index 0000000..a2e23fd
--- /dev/null
+++ b/releasenotes/notes/bug-1791007-328a8b9a43bfb157.yaml
@@ -0,0 +1,8 @@
+---
+fixes:
+  - |
+    Fixed bug #1791007. ``tempest workspace register`` and ``tempest workspace rename`` CLI will
+    error if None or empty string is passed in --name arguments. Earlier both CLI used to accept
+    the None or empty string as name which was confusing.
+
+
diff --git a/tempest/api/compute/servers/test_delete_server.py b/tempest/api/compute/servers/test_delete_server.py
index 0093752..0263b81 100644
--- a/tempest/api/compute/servers/test_delete_server.py
+++ b/tempest/api/compute/servers/test_delete_server.py
@@ -107,11 +107,10 @@
     @utils.services('volume')
     def test_delete_server_while_in_attached_volume(self):
         # Delete a server while a volume is attached to it
-        device = '/dev/%s' % CONF.compute.volume_device_name
         server = self.create_test_server(wait_until='ACTIVE')
 
         volume = self.create_volume()
-        self.attach_volume(server, volume, device=device)
+        self.attach_volume(server, volume)
 
         self.client.delete_server(server['id'])
         waiters.wait_for_server_termination(self.client, server['id'])
diff --git a/tempest/api/compute/servers/test_server_rescue_negative.py b/tempest/api/compute/servers/test_server_rescue_negative.py
index 1260c6b..caceb64 100644
--- a/tempest/api/compute/servers/test_server_rescue_negative.py
+++ b/tempest/api/compute/servers/test_server_rescue_negative.py
@@ -43,7 +43,6 @@
     @classmethod
     def resource_setup(cls):
         super(ServerRescueNegativeTestJSON, cls).resource_setup()
-        cls.device = CONF.compute.volume_device_name
         cls.password = data_utils.rand_password()
         rescue_password = data_utils.rand_password()
         # Server for negative tests
@@ -125,8 +124,7 @@
         self.assertRaises(lib_exc.Conflict,
                           self.servers_client.attach_volume,
                           self.server_id,
-                          volumeId=volume['id'],
-                          device='/dev/%s' % self.device)
+                          volumeId=volume['id'])
 
     @decorators.idempotent_id('f56e465b-fe10-48bf-b75d-646cda3a8bc9')
     @utils.services('volume')
@@ -136,7 +134,7 @@
 
         # Attach the volume to the server
         server = self.servers_client.show_server(self.server_id)['server']
-        self.attach_volume(server, volume, device='/dev/%s' % self.device)
+        self.attach_volume(server, volume)
 
         # Rescue the server
         self.servers_client.rescue_server(self.server_id,
diff --git a/tempest/api/compute/volumes/test_attach_volume.py b/tempest/api/compute/volumes/test_attach_volume.py
index 811b521..f7b5b4b 100644
--- a/tempest/api/compute/volumes/test_attach_volume.py
+++ b/tempest/api/compute/volumes/test_attach_volume.py
@@ -84,6 +84,11 @@
             linux_client.validate_authentication()
 
         volume = self.create_volume()
+
+        # NOTE: As of the 12.0.0 Liberty release, the Nova libvirt driver
+        # no longer honors a user-supplied device name, in that case
+        # CONF.compute.volume_device_name must be set the equal value as
+        # the libvirt auto-assigned one
         attachment = self.attach_volume(server, volume,
                                         device=('/dev/%s' % self.device))
 
@@ -121,8 +126,7 @@
         # List volume attachment of the server
         server, _ = self._create_server()
         volume_1st = self.create_volume()
-        attachment_1st = self.attach_volume(server, volume_1st,
-                                            device=('/dev/%s' % self.device))
+        attachment_1st = self.attach_volume(server, volume_1st)
         body = self.servers_client.list_volume_attachments(
             server['id'])['volumeAttachments']
         self.assertEqual(1, len(body))
@@ -234,8 +238,7 @@
         volume = self.create_volume()
         num_vol = self._count_volumes(server, validation_resources)
         self._shelve_server(server, validation_resources)
-        attachment = self.attach_volume(server, volume,
-                                        device=('/dev/%s' % self.device))
+        attachment = self.attach_volume(server, volume)
 
         # Unshelve the instance and check that attached volume exists
         self._unshelve_server_and_check_volumes(
@@ -264,7 +267,7 @@
         self._shelve_server(server, validation_resources)
 
         # Attach and then detach the volume
-        self.attach_volume(server, volume, device=('/dev/%s' % self.device))
+        self.attach_volume(server, volume)
         self.servers_client.detach_volume(server['id'], volume['id'])
         waiters.wait_for_volume_resource_status(self.volumes_client,
                                                 volume['id'], 'available')
diff --git a/tempest/api/compute/volumes/test_attach_volume_negative.py b/tempest/api/compute/volumes/test_attach_volume_negative.py
index 8618148..6d08f90 100644
--- a/tempest/api/compute/volumes/test_attach_volume_negative.py
+++ b/tempest/api/compute/volumes/test_attach_volume_negative.py
@@ -35,9 +35,7 @@
     def test_delete_attached_volume(self):
         server = self.create_test_server(wait_until='ACTIVE')
         volume = self.create_volume()
-
-        path = "/dev/%s" % CONF.compute.volume_device_name
-        self.attach_volume(server, volume, device=path)
+        self.attach_volume(server, volume)
 
         self.assertRaises(lib_exc.BadRequest,
                           self.delete_volume, volume['id'])
diff --git a/tempest/cmd/workspace.py b/tempest/cmd/workspace.py
index 929a584..d276bde 100644
--- a/tempest/cmd/workspace.py
+++ b/tempest/cmd/workspace.py
@@ -86,6 +86,7 @@
     def rename_workspace(self, old_name, new_name):
         self._populate()
         self._name_exists(old_name)
+        self._invalid_name_check(new_name)
         self._workspace_name_exists(new_name)
         self.workspaces[new_name] = self.workspaces.pop(old_name)
         self._write_file()
@@ -128,6 +129,12 @@
                 name))
             sys.exit(1)
 
+    def _invalid_name_check(self, name):
+        if not name:
+            print("None or empty name is specified."
+                  " Please specify correct name for workspace.")
+            sys.exit(1)
+
     def _validate_path(self, path):
         if not os.path.exists(path):
             print("Path does not exist.")
@@ -141,6 +148,7 @@
         # This only happens when register is called from outside of init
         if not init:
             self._validate_path(path)
+        self._invalid_name_check(name)
         self._workspace_name_exists(name)
         self.workspaces[name] = path
         self._write_file()
diff --git a/tempest/tests/cmd/test_workspace.py b/tempest/tests/cmd/test_workspace.py
index 3ed8a10..a256368 100644
--- a/tempest/tests/cmd/test_workspace.py
+++ b/tempest/tests/cmd/test_workspace.py
@@ -122,6 +122,17 @@
         self.assertIsNone(self.workspace_manager.get_workspace(self.name))
         self.assertIsNotNone(self.workspace_manager.get_workspace(new_name))
 
+    def test_workspace_manager_rename_no_name_exist(self):
+        no_name = ""
+        with patch('sys.stdout', new_callable=StringIO) as mock_stdout:
+            ex = self.assertRaises(SystemExit,
+                                   self.workspace_manager.rename_workspace,
+                                   self.name, no_name)
+        self.assertEqual(1, ex.code)
+        self.assertEqual(mock_stdout.getvalue(),
+                         "None or empty name is specified."
+                         " Please specify correct name for workspace.\n")
+
     def test_workspace_manager_move(self):
         new_path = tempfile.mkdtemp()
         self.addCleanup(shutil.rmtree, new_path, ignore_errors=True)
@@ -184,3 +195,15 @@
         self.assertEqual(1, len(listed))
         self.assertIn(self.name, listed)
         self.assertEqual(self.path, listed.get(self.name))
+
+    def test_register_new_workspace_no_name(self):
+        no_name = ""
+        with patch('sys.stdout', new_callable=StringIO) as mock_stdout:
+            ex = self.assertRaises(SystemExit,
+                                   self.workspace_manager.
+                                   register_new_workspace,
+                                   no_name, self.path)
+        self.assertEqual(1, ex.code)
+        self.assertEqual(mock_stdout.getvalue(),
+                         "None or empty name is specified."
+                         " Please specify correct name for workspace.\n")