Bug 1118172

Summary: Unexpected warning appears when delete invalid container
Product: OKD Reporter: Wenjing Zheng <wzheng>
Component: ContainersAssignee: Clayton Coleman <ccoleman>
Status: CLOSED WONTFIX QA Contact: libra bugs <libra-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 2.xCC: jokerman, mfojtik, mmccomas, pmorie
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-02-03 17:54:36 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Wenjing Zheng 2014-07-10 06:43:24 UTC
Description:
If delete a container just with name contains the first 4 letters(like rock here, sudo gear delete rock), the first contains which matches with the 4 letters in name will be deleted successfully, but unexpected warnings appears:delete_container: Unable to queue stop unit job: Unit ctr-rock.service not loaded. Deleted rock; 

But if delete with first 3 letters in name(sudo gear delete roc), it fails and valid warning returns like this:You must pass one or more valid service names: identifier must match \A[a-zA-Z0-9\_\-\.]{4,24}\z

Version-Release number of selected component (if applicable):
geard-0-0.13.git6850c8d
fedora20_x86_64

How reproducible:
always

steps to Reproduce:
1. Create a rockmongo.json file to deploy with below contents:
{
  "containers":[
    {
      "name":"rockmongo",
      "count":3,
      "image":"openshift/centos-rockmongo",
      "publicports":[
        {"internal":80, "external":0}
      ],
      "links":[
        {"to":"mongodb"}
      ]
    }
  ]
}
2. sudo gear deploy rockmongo.json
3. sudo gear list-units
ID          SERVER  ACTIVE  SUB     LOAD    TYPE
rockmongo-1         active  running loaded  
rockmongo-2         active  running loaded  
rockmongo-3         active  running loaded 
4. delete with the first 4 letters: rock
sudo gear delete rock
5. stop a container
sudo gear stop rockmongo-1
6. sudo gear delete rock
7. the first contianer begin with rock will be deleted:
sudo gear list-units
ID          SERVER  ACTIVE  SUB     LOAD    TYPE
rockmongo-2         active  running loaded  
rockmongo-3         active  running loaded 

Actual results:
In step 4, this warning appears, nothing is deleted:
delete_container: Unable to queue stop unit job: Unit ctr-rock.service not loaded.
Deleted rock
After step 6, rockmongo-1 is deleted and above warning appears too

Expected results:
1. It should warn like this when delete with first 3 letters:
[vagrant@localhost ~]$ sudo gear delete roc
You must pass one or more valid service names: identifier must match \A[a-zA-Z0-9\_\-\.]{4,24}\z
2. If we intend to delete all contians sharing some same beginning letters in name, we should use wildcards, for example "*".

Additional info:
1. If all rockmongo-* in list are stoped, the warning still appears and they will be all deleted.
2. If delete a non-exist container, the same warning appears and says it is deleted:
[vagrant@localhost ~]$ sudo gear delete 1234
delete_container: Unable to queue stop unit job: Unit ctr-1234.service not loaded.
Deleted 1234

Comment 1 Clayton Coleman 2014-07-10 14:28:29 UTC
What version of systemd do you have on your system?

Comment 2 Wenjing Zheng 2014-07-11 01:55:36 UTC
Below is the version of systemd when meet this issue:
[vagrant@localhost ~]$ rpm -qa systemd
systemd-208-17.fc20.x86_64

Comment 3 Michal Fojtik 2014-07-11 08:30:44 UTC
I don't like this error message:

"identifier must match \A[a-zA-Z0-9\_\-\.]{4,24}\z"

isn't there a better 'human-friendly' way? (identifier must be XYZ character longs and contain alpha letter and number and '-'....) ?